当我使用它时,它只会在我教它另一个词的时候说,我不能让它在目录中说出一个具体的答案,你们对如何解决这个问题有什么意见吗,我很困惑。
@ECHO OFF
@mode con cols=55 lines=10
if not exist data.txt echo.>data.txt
:begin
set /p text="Talk: "
for /f "tokens=1,* delims=@" %%i in (data.txt) do (
if /i "%text%"=="%%i" (
echo Visu: %%j
goto begin
)
)
:Learn
echo --- I don't know that.
set /p answer=--- What would be a good answer to '%text%'?
echo %text%@%answer%>>data.txt
echo Visu: thank you
goto Aye
:Aye
echo set speech = Wscript.CreateObject("SAPI.spVoice") >> "temp.vbs"
echo speech.speak "%answer%" >> "temp.vbs"
start temp.vbs
pause
del temp.vbs
goto begin发布于 2017-08-08 09:28:14
@ECHO OFF
mode con cols=55 lines=10
if not exist data.txt Type Nul >data.txt
:begin
cls& Echo Talk to Visu
set "text=" & set /p text="Talk: "
if not defined text exit /B
for /f "tokens=1,* delims=@" %%i in (data.txt
) do if /i "%text%"=="%%i" Call :Aye "%%~j" & Goto :begin
:Learn
echo --- I don't know that.
echo --- What would be a good answer to '%text%'
set /p answer=?
echo %text%@%answer%>>data.txt
Call :Aye "%answer%"
goto :begin
:Aye
echo Visu: %~1
echo Visu: thank you
echo set speech = Wscript.CreateObject("SAPI.spVoice") > "temp.vbs"
echo speech.speak "%~1" >> "temp.vbs"
cscript //Nologo temp.vbs
Timeout /T 3 /Nobreak >Nul
del temp.vbs
goto :Eof发布于 2017-08-08 05:14:47
将start temp.vbs替换为cscript /nologo temp.vbs。
也许你想
echo set speech = Wscript.CreateObject("SAPI.spVoice") > "temp.vbs"
(>而不是>>)每次都要覆盖文件吗?
https://stackoverflow.com/questions/45558088
复制相似问题