Windows command line: start / wait for a text field

Hi, when I run the next BAT file, it does not wait for Wordpad to complete. Notepad starts immediately. How can I make him 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 
+4
source share
2 answers

Perfect question for procmon !

On my system (also Windows 7), the write.exe file actually starts the wordpad.exe process and then exits. Since your "start / wait" only waits on write.exe, it returns as soon as write.exe shuts down.

procmon screen

If you started / started wordpad.exe ..., it should really wait until the text panel comes out.

+4
source

start / wait notepad && & start text panel

+1
source

All Articles