[英]Windows command line: start /wait wordpad
Hi, when I run the following BAT file, it doesn't wait for Wordpad to terminate. 嗨,当我运行以下BAT文件时,它不会等待Wordpad终止。 Notepad starts immediately. 记事本立即启动。 How can I make it wait? 我怎么能让它等待? I am using 64-bit Windows 7. 我使用的是64位Windows 7。
REM Close notepad.
taskkill /im notepad.exe /f
REM Start Wordpad and wait until it terminates.
start /wait write.exe C:\Users\dell\Downloads\test.txt
REM Restart Notepad.
start notepad.exe C:\Users\dell\Downloads\test2.txt
PAUSE
A perfect question for procmon ! 对于一个完美的问题莫过于procmon !
On my system (also Windows 7), write.exe actually starts up the wordpad.exe process and then exits. 在我的系统(也是Windows 7)上,write.exe实际上启动了wordpad.exe进程,然后退出。 Since your "start /wait" is only waiting on write.exe, it returns as soon as write.exe exits. 由于您的“开始/等待”仅在write.exe上等待,因此只要write.exe退出就会返回。
If you do "start /wait wordpad.exe ...", it should indeed wait until wordpad exits. 如果你“开始/等待wordpad.exe ...”,它应该等到wordpad退出。
开始/等待记事本&&启动wordpad
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.