我正在创建一个 bactch 文件,该文件又需要在第二个窗口中创建和执行另一个 bactch 文件。我正在使用“开始”命令,但在新窗口中,超时和 ping 等基本命令因无法识别而失败。请注意,如果我从命令行运行 start 而不是在批处理文件中运行,则没有任何问题,这只发生在批处理文件中使用 start 时。请问有什么想法吗?:)
Btw o/s 是 windows 7 Pro SP1 64 位。
-- 原始窗口 --
C:\mydir>start tmp.bat
- 新窗户 -
C:\mydir>c:
C:\mydir>cd \mydir
C:\mydir>echo Please wait for 60 seconds...
Please wait for 60 seconds...
C:\mydir>timeout 60
'timeout' is not recognized as an internal or external command,
operable program or batch file.
C:\mydir>ping 127.0.0.1
'ping' is not recognized as an internal or external command,
operable program or batch file.
-- 完整的批处理文件 --
set drive=c:
set path=\mydir
set tmpbatch=tmp.cmd
%drive%
cd %path%
echo %drive% > %tmpbatch%
echo cd %path% >> %tmpbatch%
echo echo Please wait for 60 seconds... >> %tmpbatch%
echo timeout 60 >> %tmpbatch%
echo copy config\topology.default.txt config\topology.txt >> %tmpbatch%
echo copy config\fasrc.default config\fasrc >> %tmpbatch%
echo echo demolive2^|localhost^|3^|demo^|Live Query Instance 2 for demo setup ^>^> config\topology.txt >> %tmpbatch%
echo bin\setup-cluster >> %tmpbatch%
echo findstr ERROR data\log\agent.log data\instances\deployment\log\kitchen.log >> %tmpbatch%
echo bin\capture-import demo demo\config\demo-config-capture.zip >> %tmpbatch%
echo bin\run-etl-job run.kjb "-DINSTANCE=demo" "-DTRIGGER=load-data" >> %tmpbatch%
echo bin\reindex demo >> %tmpbatch%
echo start "~\iexplore.exe" "http://localhost:8180/preview" >> %tmpbatch%
echo echo Please publish the configuration to the servers using File ^^^> File in the Business Manager >> %tmpbatch%
echo echo Press a key to continue once you have done that... >> %tmpbatch%
echo pause >> %tmpbatch%
echo bin\reindex demo >> %tmpbatch%
echo bin\fresh-index-to-live demo >> %tmpbatch%
echo echo All done! Check back for errors... >> %tmpbatch%
echo pause >> %tmpbatch%
echo del %tmpbatch% >> %tmpbatch%
start %tmpbatch%
bin\deployment-agent