Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Windows, when my program starts up from the command line, it displays a window, and on the command prompt it lets me enter another command. It is essentially the Linux equivalent of

./myprogram.exe &

Now, I don't want this. I want to see my console output. Is there any command line argument or some other way to block command prompt from giving me another prompt until the program terminates?

share|improve this question

2 Answers 2

up vote 2 down vote accepted
start /wait "" myprogram.exe

The empty string "" is the window title. It isn't really needed as I have it written, but it is a good idea to include it. It becomes important if your executable program path requires enclosing quotes due to spaces or other special characters, in which case the program will be mistakenly treated as the window title unless a quoted title string precedes it.

There are a number of options with the START command. Type START /? from a command prompt to get help.

Note that some Windows programs launch additional processes that do the real work, and the initial process terminates. START /WAIT would not help with such a program.

share|improve this answer
    
it stops prompting, but debug messages do not print. the main thread starts up a bunch of service threads that do the real work, then starts up another process and terminates. Any way to get the debug outputs in this scenario? –  wonton Jun 4 '13 at 19:40

I doubt it. Normal behavior is like linux. I think If you want to get the ./myprogram & behaviour in windows, you do C:\>start myprogram But as you say, you don't want that. But the default is (as with linux) not to do that.

The fact that your program continues running after the window is shown, suggests to me that this functionality is built into the program, so it executes the window as a new thread. I don't think cmd can stop that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.