How do I create a Windows Batch file that does not show the Command Prompt when executed? [duplicate]

You can't -- executing a batch file with the built in Command Prompt is going to keep a window open until the batch file exits.

What you can do is take steps to make sure that the batch file exits as quickly as possible. If at all possible, modify the batch file to run whatever program with the start command. By default, start returns immediately without waiting for the program to exit, so the batch file will continue to run and, presumably, exit immediately. Couple that with modifying your shortcut to run the batch file minimized, and you'll only see the taskbar flash without even seeing a window onscreen.

One caveat to this is that if you're running a console-mode program, which many script interpreters are, the batch file will wait for the program to exit, and using start will spawn a new console window. What you need to do in this case is run the Windows-based version of the interpreter instead of the console-based one -- no start necessary. For Perl, you would run wperl.exe instead of perl.exe. For Python, it's pythonw.exe instead of python.exe. The old win32 Ruby distribution I have downloaded has rubyw.exe, which should do the same thing.

A final possibility is to use a 3rd-party tool to run the command prompt with a hidden window. I've heard of such things but never had a use for them, so I don't know of anything in particular to point you to.


I think this is the easiest and shortest solution to running a batch file without opening the DOS window, it can be very distracting when you want to schedule a set of commands to run periodically, so the DOS window keeps popping up, here is your solution. Use a VB Script to call the batch file ...

Set WshShell = CreateObject("WScript.Shell" ) 
WshShell.Run chr(34) & "C:\Batch Files\ mycommands.bat" & Chr(34), 0 
Set WshShell = Nothing 

Copy the lines above to an editor and save the file with .VBS extension. Edit the .BAT file name and path accordingly. Then just run the .vbs file and the magic happens!

You can create a task on Task Scheduler then in the Action should be Start a program then select this .vbs script you created. Depending on your requirements the other properties you can fill and save.


You can run another batch file with START /MIN CMD.EXE /C mybatchfile.bat from within the command prompt.

From outside it will bring the cmd console window but to avoid that, you can create a shortcut file with properties modified to start minimized.