Run .BAT or .CMD Files in Hidden Mode Using a Script
Ohidur Rahman Bappy
MAR 22, 2025
Run .BAT or .CMD Files in Hidden Mode Using a Script
Windows Script Host’s Run Method offers a way to execute programs or scripts in invisible mode. Below is an example of a Windows script designed to launch a batch file named syncfiles.bat
without any visible interface.
Reference: Run Method Documentation. Setting the intWindowStyle parameter to 0 hides the window.
Instructions
Suppose you have a batch file named syncfiles.bat
located in the C:\Batch Files
directory. Here's how you can launch it in hidden mode using a Windows Script:
-
Copy the Script
Open Notepad and paste the following lines:
Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "C:\Batch Files\syncfiles.bat" & Chr(34), 0 Set WshShell = Nothing
Note: Adjust the batch file name and path in the script to fit your specific needs.
-
Save the Script
Save the file with a
.VBS
extension, such aslaunch_bat.vbs
. -
Edit as Needed
Modify the .BAT file name and path as needed, then save the file.
-
Execute the Script
Double-click the
launch_bat.vbs
file. This will run thesyncfiles.bat
file in invisible mode.
For more information, visit the source article.