简体   繁体   English

暂停命令在.bat脚本中不起作用

[英]Pause command not working in .bat script

The batch file has only two lines: 批处理文件只有两行:

c:\program.exe ...
pause

but pause does't run after "program" completes... I don't see that "press any key message" :( 但是在“程序”完成后,暂停不会运行...我看不到“按任何关键消息” :(

If I move pause on the first line, then it magically works. 如果我在第一行上移动了暂停,那么它将神奇地起作用。

It fails because you are not running an executable directly - you are running it via the phpunit.bat batch file (based on information in comment added to question). 它失败是因为您没有直接运行可执行文件-您正在通过phpunit.bat批处理文件运行它(基于添加到问题的注释中的信息)。

You must CALL a batch file from within another batch file if you want to return to the caller 如果要返回到调用方,则必须从另一个批处理文件中调用一个批处理文件

call phpunit
pause

在打开bat文件之前尝试保存,它对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM