Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a scheduled task that starts a batch script that runs robocopy every hour. Every time it runs a window pops up on the desktop with robocopy's output, which I don't really want to see.

I managed to make the window appear minimized by making the scheduled job run

cmd /c start /min mybat.bat

but that gives me a new command window every hour. I was surprised by this, given cmd /c "Carries out the command specified by string and then terminates" - I must have misunderstood the docs.

Is there a way to run a batch script without it popping up a cmd window?

share|improve this question
I found this one a more preferable answer… – Efekt May 10 '14 at 5:46
Here I've tried to compile all possible ways to start a hidden process on windows without external tools. – npocmaka Feb 2 '15 at 23:33

10 Answers 10

up vote 104 down vote accepted

You could run it silently using a Windows Script file instead. The Run Method allows you running a script in invisible mode. Create a .vbs file like this one

Dim WinScriptHost
Set WinScriptHost = CreateObject("WScript.Shell")
WinScriptHost.Run Chr(34) & "C:\Scheduled Jobs\mybat.bat" & Chr(34), 0
Set WinScriptHost = Nothing

and schedule it. The second argument in this example sets the window style. 0 means "hide the window."

Complete syntax of the Run method:

 object.Run(strCommand, [intWindowStyle], [bWaitOnReturn])


  • object: WshShell object.
  • strCommand: String value indicating the command line you want to run. You must include any parameters you want to pass to the executable file.
  • intWindowStyle: Optional. Integer value indicating the appearance of the program's window. Note that not all programs make use of this information.
  • bWaitOnReturn: Optional. Boolean value indicating whether the script should wait for the program to finish executing before continuing to the next statement in your script. If set to true, script execution halts until the program finishes, and Run returns any error code returned by the program. If set to false (the default), the Run method returns immediately after starting the program, automatically returning 0 (not to be interpreted as an error code).
share|improve this answer
+1, just wrote exactly the same thing – Sam May 17 '09 at 9:10
I saw it before you deleted it. I guess we are both bots. ;-) – splattne May 17 '09 at 9:14
always with the great answers! i was about to write that you deserve to become the Jon Skeet of serverfault... then i realized you already have :-) – username May 17 '09 at 13:04
username, I honestly think that Sam deserves it much more than me. But thank you anyway! And don't mention me and Jon Skeet in the same sentence. That's blasphemy! ;-) – splattne May 17 '09 at 14:00
To the question "Is there a way to run a batch script without it popping up a cmd window?", it gives a very direct answer: Run it using a Windows Script file. – Mark Meuer Aug 2 '12 at 15:51

Are you running this as a scheduled task? If so set it to run as a different user account then it won't be visible to the logged on user. If the script needs no network access to items that need windows auth (like file shares or printers), you can run it as "nt authority\system" and leave the password blank. On Windows 7, just set the user to SYSTEM, and press OK.

(You probably have to use a real user though if you're using robocopy...)


share|improve this answer
Thanks - this was less hassle for me than the .vbs option. – mackenir Feb 10 '10 at 16:45
I like the idea, but I am the only user on this desktop, and its a work PC so cannot create others. When ever I select anything else in the "Run as" box, it asks for a password and confirmation, of which mine fails. – IanVaughan Feb 9 '11 at 15:19
I set the "Run as" user to SYSTEM (which it later changed o NT AUTHORITY\SYSTEM) and it worked for me. I no longer see the popup CMD window when my scheduled task runs. Thanks! – Ryan Stille Mar 25 '11 at 17:28
+1, this is elegant. Be sure to enter "system" as the user name, then win7 does the rest for you. Note that you DO get network access to the internet, just not to network shares and things that need windows auth. – samsmith Mar 2 '12 at 4:36
System user is simple and elegant, great TIP! +1 ! – Matteo Conta Oct 30 '12 at 8:40

You could also try CHP (Create hidden process), does exactly what you'd think...

CHP.EXE mybat.bat

Runs with no command window. Perfect! Made by the same people as CMDOW, but this is more appropriate.

share|improve this answer

CMDOW is an awsome tool that allows you to do many, many things to windows from the command line.

One of the simplest things to do is hide the current window (usually as a first line in the bat file) with:

cmdow @ /hid

or start a new hidden process with

cmdow /run /hid mybat.bat
share|improve this answer
Both this and Rocketmonkeys suggestion involve downloading new tools, which means more compatibility over various peoples desktops. The baked in, using windows commands is much better. – IanVaughan Feb 9 '11 at 15:14
Plus cmdow is detected as "hazardous" by some anti-virus programs (it is not hazardous, but the detection can itself cause some problems if the cmdow file is quarantined...). – Otiel Dec 10 '12 at 15:36
there is still popup console, just flash very quick. – Bamboo Jul 22 '14 at 10:37

Simply configure the Scheduled Task as "Run whether user is logged on or not".

share|improve this answer
Perfect! You can even disable credential storage and then this ends up being more secure than having SYSTEM run it! – binki Aug 19 '15 at 17:50

Try invoking the script with

start /b <command>
share|improve this answer
This does not work, the Scheduled Task->Status states "Could not start", thats with : start /b C:\file.bat : and : start /b "C:\file.bat" : but : C:\file.bat : works just fine. – IanVaughan Feb 9 '11 at 15:12
Because start is not a program, it is a command. You need to specify cmd as the program to run and /c start /b <file> as the argument. However, this is still not going to work because it will still create a console window for cmd and flash a black window on screen. – Synetech Oct 2 '15 at 20:23

You can create a shortcut to the batch file, set the shortcut to start minimized (in the shortcut's properties, 'Shortcut' tab), and then set the job to start the shortcut.

Important: You'll need to specify the path to the shortcut manually by typing it into the Run text field, complete with the '.lnk' extension; if you just try to browse to it, it will helpfully redirect itself to whatever the shortcut points to.

share|improve this answer

Another solution I've used is Hidden Start

share|improve this answer

Try putting in an exit command at the end of your batch file. This should close the command window when the script is done.

share|improve this answer

To hide the output (although not the window), add this to the beginning of your batch file:

@echo off
share|improve this answer

protected by Tom O'Connor Aug 18 '14 at 8:53

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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