I want to start a command prompt but don’t want any output from it. So I am starting it as –
cmd /q dir
which works fine but one cmd.exe doesn’t exit. If I use this-
cmd /q /c dir
I can see output of dir command which I don’t expect to see
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The /Q option does not disable output, it only turns ECHO OFF. It is not normally needed, but there are occasions where it becomes useful.
To disable all non-error output, simply redirect the stdout to nul (
>nulor1>nul). If you also want to disable error output, then stderr must also be redirected (2>nul).Addendum
Andriy M has a good point with his comment on the question. You can probably execute your command directly without going through CMD. Redirection would still work the same.