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.
开始/等待记事本&&启动wordpad
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.