或是装完speechsdk51.exe之后可以参考 C:Program FilesMicrosoft Speech SDK 5.1SamplesScriptsSimpleTTSSimpleTTS.html这个文件。 如果让电脑听你的命令,下边是vbs代码 复制代码 代码如下: "========================================================================== " Name : CommandPC.VBS " AUTHOR : HUAYING " DATE : 2005-1-31 "========================================================================== Dim CommandDictionary "命令字典对象 Dim WshShell "WshShell对象提供对本地Windows程序的访问。 Dim ScriptComplete "程序结束标志 Dim SR "语音识别(Speech Recognition)对象 Dim Grammar "语音识别的命令语法对象 "初始化命令字典对象,可根据自己的需要添加命令 Set CommandDictionary = CreateObject("Scripting.Dictionary") CommandDictionary.Add "上网","""C:Program FilesInternet Exploreriexplore.exe""" "注意双引号的数目 CommandDictionary.Add "计算器", "calc" CommandDictionary.Add "记事本", "notepad" CommandDictionary.Add "空当接龙", "freecell" Set WshShell = CreateObject("WScript.Shell") "创建WshShell对象 ScriptComplete = False "初始化程序结束标志 "创建语音识别对象,调用由"Command.XML"所定义的语法,并启动语音识别引擎 Set SR = WScript.CreateObject("SAPI.SpSharedRecoContext", "RecoContext_") Set Grammar = SR.CreateGrammar Grammar.CmdLoadFromFile "x.xml", SLODynamic Grammar.CmdSetRuleIdState 0, 1 MsgBox "你好,主人,请吩咐。" "等候你的语音命令(需要安装麦克风) "当识别出"命令结束"命令时程序结束 Do WScript.Sleep 1000 Loop Until ScriptComplete MsgBox "欢迎再跟我说话,再见!" "你的语音命令被识别 Sub RecoContext_Recognition(ByVal StreamNumber,ByVal StreamPosition,ByVal RecognitionType,ByVal Result ) Text = Result.PhraseInfo.GetText "获取语音识别引擎所识别的命令 If Text <> "命令结束" Then WshShell.Run CommandDictionary.Item(Text) "由WshShell对象Run方法执行你的命令 Else ScriptComplete = true "程序结束标志 End If End Sub