Hi, when I run the following BAT file, it doesn't wait for Wordpad to terminate. Notepad starts immediately. How can I make it wait? I am using 64-bit 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!
On my system (also Windows 7), write.exe actually starts up the wordpad.exe process and then exits. Since your "start /wait" is only waiting on write.exe, it returns as soon as write.exe exits.
If you do "start /wait wordpad.exe ...", it should indeed wait until wordpad exits.
start /wait notepad && start wordpad
精彩评论