Batch files (.BAT) and Windows NT Command Script (.CMD) files run in console window when double-clicked. This means that the Command Prompt window will be visible until the .BAT/.CMD file execution is complete. To make .BAT or .CMD file execution less intrusive, you can configure it to run minimized. Or if the .BAT or .CMD file does not require user input during run time, you can launch it in invisible mode using a Script. Both options are discussed below.
Running .BAT or .CMD files in minimized mode
- Create a shortcut to the .BAT or .CMD file. To do so, right click on the file, click Send To, Desktop (create shortcut)
- Right click on the shortcut and choose Properties
- In the Run: drop down, choose Minimized
- Click OK
- Double-click the shortcut to run the batch file in a minimized window state.
Running .BAT or .CMD files in invisible mode
Windows Script Host’s Run Method allows you run a program or script in invisible mode.
Sample Code
“C:\Batch Files\syncfiles.bat”
Chr(34), 0 Set WshShell = Nothing
Copy the lines above to Notepad and save the file with .VBS extension. Edit the .BAT file name and path accordingly, and save the file. Double-click the .VBS file to run it.
(Ref: Run Method. Setting intWindowStyle parameter to 0 hides the window)