Despite what the documentation says, I cannot get start /wait to work with /b, despite stabbing in the dark trying nearly every possible combination of inputs I can imagine. My command path does not contain spaces, so this is not a quoting issue.

This works:

start /wait <path-to-.exe> <param1> <param2> ...

This does NOT work:

start /wait /b <path-to-.exe> <param1> <param2> ...

The program I'm trying to run is a cli/console application, so this caveat (from start /help) shouldn't apply:

When executing an application that is a 32-bit GUI application, CMD.EXE
    does not wait for the application to terminate before returning to
    the command prompt.  This new behavior does NOT occur if executing
    within a command script.
link|improve this question
Seems to be working in Windows 7. Could you us give the OS Version and application name? – jon Z Nov 6 '11 at 10:16
@jonZ, I can reproduce the problem on a variety of systems, e.g., I've tested Windows 7 SP1 32-bit, 2008 R2 SP1 64-bit, and Windows 2003 SP2 32-bit. The start command ignores the /wait option if it is followed by /b, e.g., start /wait /b notepad won't wait. Could you test again? – Harry Johnston Nov 6 '11 at 22:03
feedback

migrated from stackoverflow.com Nov 9 '11 at 2:44

This question came from our site for professional and enthusiast programmers.

1 Answer

This appears to be a bug in the implementation of the start command. There's a simple workaround:

start /wait /b mycommand

doesn't work (the /wait argument is ignored) but

start /b /wait mycommand

does. (Note that in this simple example you might as well just run mycommand directly, but this workaround may be useful if you want use options such as /low or /i.)

link|improve this answer
@jonZ: I've retested using schtasks.exe and it still behaves as before, see my edited answer containing console output from these tests. Would you mind reproducing these two tests in the same way I've done them, to make sure we're trying exactly the same thing? – Harry Johnston Nov 8 '11 at 3:19
I'm getting the same results here. The waiting I was referring to earlier was the pause after executing start /wait /b schtasks.exe. – jon Z Nov 8 '11 at 21:52
@jonZ: OK, thanks. – Harry Johnston Nov 8 '11 at 22:11
feedback

Your Answer

 
or
required, but never shown