Running .BAT file minimized or invisible

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

Even better:

Windows Script Host’s Run Method allows you to run a program or script in invisible mode.

Sample Code:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "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.

Advertisements

3 Comments on “Running .BAT file minimized or invisible”

  1. Peter says:

    Where is in the script the reference to invisibility parameter/option?

    • crcok says:

      Frankly – I don’t know. I did not write it. I just got it off the Net when I urgently needed something like this to solve an issue and just put it to use and it worked like a charm.

  2. […] connection command out into a batch file somewhere in you user directory and make it run invisibly (like this). Though doing so would expose your plain text username and password to considerably higher risk of […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s