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.

I'd like to run a particular application (let's call it foo) from the command line, but I don't want it holding up the terminal, putting any junk in the terminal from its output or error streams, and also want it to keep running even if I close said terminal. In Bash, I can do that using (foo &>/dev/null &), but I don't know how I would do that in Windows shell. Could someone please help me?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The way you would do this in Windows is:

start /B foo > NUL 2>&1

The start command will start a detached process, a similar effect to &. The /B option prevents start from opening a new terminal window if the program you are running is a console application (it is unnecessary for GUI applications). The > has the same meaning as in Linux, and NUL is Windows' equivalent of /dev/null. The 2>&1 at the end will redirect stderr to stdout, which will all go to NUL.

share|improve this answer
    
@KozRoss - This indeed prevents console app foo from holding up the terminal (console window). But I think foo does not continue if the terminal (console window) is closed. I believe closing the window terminates all console apps that are running within it. I know this is true if foo is a batch script, based on experiments. I haven't tested an exe or CScript. –  dbenham Jul 5 at 19:12

There is no direct equivalent.

As described here, calling a program in a way that doesn’t block the caller can be done with the start command, using the /b option. Dunno about output redirection in this case, though. You might have to wrap it in a batch file.

As for > /dev/null, it’s easy: >NUL. NUL is a DOS device name. The shorthand operator, however, is not available. You’ll have to go the manual way with 2>&1. Here’s some more info on 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.