"Invisible" Batch Files

Written: 06/30/13

Last Updated: 06/30/13

This techtorial will teach you how to create a batch file that will launch completely hidden. I do not mean starting it minimized, but rather making it entirely transparent to the user, such that it will appear that the batch file was never run. This can be used for many different purposes, my personal favorite is for launching scheduled tasks. I cover that in this article, but for now I will focus on how to make that batch file become invisible.

Just to further clarify, the batch file will only launch hidden; it will still be visible in the task manager. You will be able to see it as “cmd.exe”.

First start off by opening your favorite text editor. Copy and paste the following line into the file and save it as “invis.vbs”. It is very important that the extension be *.vbs, not *.txt. What we are actually doing is creating a Visual Basic Script (VBS). In this example, we are executing whatever the command line argument was. The last two parameters of the run command specify the window to be hidden and for wscript to not wait for the command to finish executing.

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Now make your batch file. Let’s call it “run.bat”. For the simple purpose of demonstration, I only put the following line in my batch file:


That batch file does nothing more than open up notepad. Once again, pay attention to your file extension, make sure it ends in *.bat.

Open up CMD and navigate to where the files are. Then launch the batch file by issuing the following command:

invis.vbs run.bat

You should see notepad appear, without seeing the DOS window.

That’s all there is to it. You can now launch any batch file, without seeing a DOS window.

If you’d rather hard code your batch file into the VBScript, simply change the VBS file to be:

CreateObject("Wscript.Shell").Run "D:\Desktop\run.bat", 0, False

In the above example, I have run.bat located in D:\Desktop; make sure to change that to the full path of your batch file. Now whenever you run invis.vbs, your batch file will automatically run, hidden.

You can expand this concept to launching other applications hidden, as well. I specifically focused on batch files, as this allows for a lot of flexibility.

Discussion (3)

There are 3 responses to “"Invisible" Batch Files”.

  1. This is not working. but thanks..

  2. Mike responded:

    · Reply

    Works great for me…I used the hard code method. But for me it is not really hard coded as I dynamically produce the .bat and .vbs within my coding for a small application I am building that uses the bat to create a task within Windows Task Scheduler.

    Thank you for sharing this !

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.