10 Ways To Run Batch Files Silently And Hide The Console Window

Most ordinary Windows users never use the Command Prompt and have no idea what sort of things you can do from the command line. More experienced users will know that running command line commands can be very useful for a range of tasks and grouping everything into a single batch file to process it all together can be very powerful.

One inconvenience with running batch files is that they always open a console window which shows the output of the commands being executed. This can be important if you want to interact or see what is happening while the batch file is running but a bit annoying if you want to run the batch script quietly in the background or while starting windows.

batch file console output

For short batch files, the console window may appear and disappear in a flash or stay open for longer if more commands are being executed. There is no standard built in way to completely hide the console window from showing so if you want to do that another solution is required. Here we show you some different ways to make your batch script run silently without a console window showing.

Note: When using a method to hide the console window make sure the batch script contains no commands that are likely to stop the script before it exits, such as pause or requiring user input like a Yes/No response. For example, if a script has been converted into an executable and requires interaction, you won’t be able to do anything and the process will stay in Task Manager until it’s manually killed.

Run a Silent Batch Script Using a Third Party Utility

A simple and common solution for running a batch file silently is launching it via a third party utility that suppresses the console window.

Hidden Start (HStart)

Hidden Start is a portable and quite powerful tool that can launch executables and scripts with several useful options. We are using version 4.2 from 2013 because it’s portable and not as restricted as newer versions. Since version 4.3, Hidden Start is no longer portable and also pops up a nag every time you try to run a hidden console, which makes it useless for this purpose.

hidden start

Unzip and run the program with HStartUI.exe, the process consists of three steps. Manually add or drop your batch file onto the window, make sure “Hide console window” is checked and optionally check “Run with highest privileges” if your script requires it. Other setup options like priority or starting directory are not essential unless you know the script requires them.

Step 3 shows the output command that has to be manually run. You can use the buttons at the bottom to copy the command, automatically create a shortcut or add an autostart entry into the registry. Note the bypass UAC prompt option is not available in the free version (we show you how to do that for free later).

Download Hidden Start


SilentCMD

This is a small 14KB tool that is not blessed with tons of features but does the simple task which we are looking for. If you are on Windows 10, .NET Framework 3.5 will be offered for install when running the tool if it isn’t already on your system. The basic syntax to use in shortcuts or similar is quite simple.

SilentCMD [path to .bat file] [batch arguments] [options]

silentcmd

There are two additional options in SilentCMD. One is to enable logging with “/log:[path to .txt]” and the other is to start the script after a delay using “/DELAY:[xx seconds]”. Append the option to the end of the command. As long as you don’t need extra functions like elevation or a different starting directory, SilentCMD works nicely and might be all that you need.

Download SilentCMD


NirCMD

Nirsoft’s NirCMD is a small multi function tool that can quietly perform dozens of tasks without popping up any console window. These include ejecting ROM drives, changing audio volumes, enabling screensavers, controlling processes/services and much more. The following command can be used at boot or in a shortcut to run a batch file silently:

nircmd exec hide [path to .bat file]

The exec and hide commands are used to execute the script and hide any console windows from opening.

create silent batch with nircmd

Include elevatecmd to request administrator privileges for the batch file although it’s only needed if you know commands in your script require elevation.

nircmd elevatecmd exec hide [path to .bat file]

A desktop shortcut can be created manually or you can tell NirCMD to create a shortcut from the command line with the included commands so the silent script is ready to run.

nircmd cmdshortcut “~$folder.desktop$” “SilentBatch” exec hide C:\Users\Raymondcc\MyBatchFile.bat

The above will create a desktop shortcut called SilentBatch which will silently execute the MyBatchFile.bat script. Note that you may have to change the “Start in” location in the shortcut as output from the script that doesn’t supply a path will default to C:\Windows.

change start in location for nircmd shortcut

On double clicking the NirCMD executable it will offer the option to copy itself to the Windows directory so you only have to use nircmd.exe and not supply a full path every time. It’s advisable to do that if you plan to make use of NirCMD on your computer (make sure to right click and run nircmd.exe as administrator).

copy nircmd executable to windows

For full information about the wealth of commands available, have a read of the full NirCMD Help file.

Download NirCMD


Raymond.cc Silent Batch Launcher

We also have a little tool that can launch a batch file silently. It’s created in Autoit and is essentially a slightly advanced version of the “Create Your Own Executable File” method on page two. Silent Batch Launcher is designed to be simple to use and provide a slightly different option to the other tools here.

Run the executable and you will be asked to browse for a batch file. An INI file containing the path to the script will then be created next to the executable. Every time you run Silent Batch Launcher from then on it will execute the same batch file as long as the INI file is present.

raymondcc silent batch launcher

To run a different script, delete the INI file or hold Shift while launching the tool and it will popup the file requester. The INI file name will match the EXE file name so you can have differently named occurrences of the tool in the same folder. There are two files in the archive, use the “Admin” version if the script requires elevation. Any useful feedback you have about the tool is welcome.

Download Silent Batch Launcher

Note: Because this tool was created with Autoit, it does create some false positives with online virus scanners like VirusTotal.

There are a few other tools that can hide the console window of a batch script that we haven’t mentioned here. They include CmdowCreate Hidden ProcessHidecon, and Hideexec.

Hide the Batch Console With a Visual Basic Script

Hiding the batch script console window using Visual Basic is quite similar to using an external command and works in basically the same way. Launch the VB script and supply the batch file as an argument, then the code runs the script while not showing any output. It can be done with a single line of code.

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

Create an empty text file, copy and paste the above line then save it as a .vbs file. Alternatively, download launchquiet.vbs which is a ready made script. To add it to a shortcut or a startup location etc, use the commands in the following way. Don’t forget to use quotes if your paths or filenames contain spaces.

Wscript [path to .vbs file] [path to .bat file]

create a shortcut for launchquiet script

If you would like to supply an argument for the batch file, the piece of VB script has to be altered slightly by changing the two sets of four double quotes to two sets of two.

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

Then supply the arguments along with the batch script path inside quotes:

Wscript [path to .vbs file] “[path to .bat file] [argument]”

Again, for convenience, you can download a ready made launchquiet_args.vbs script file.

On the next page, we’ll look at how to convert a batch script into an executable file, how to create a batch executable without any additional software and how to run a script from a scheduled task.

Convert a Batch Script Into an Executable File

Another way to run a quiet batch file is by turning the script into an executable file. Using the right batch file to executable converter will give the option to suppress the window. One issue is a converted batch script can be flagged by security software as malicious.

Bat To Exe Converter

Bat To Exe Converter by F2KO Software is an easy converter to use while still offering additional features for intermediate and advanced users. The downloaded Zip includes both installer and portable versions and several example batch files. Note we are not using the latest version of the tool as this older one is simpler to use and does everything needed.

Drop a batch file onto the window or browse for it manually, select the Invisible application radio button and click Compile. This will auto create an executable with the same name as the batch script. Use the “Add administrator manifest” option if your script has commands that require administrator privileges. The other options are more for advanced users and not essential.

f2ko bat to exe converter

Another feature is a number of built in script commands. You can add these into your script to make certain command line tasks, which are not built into Windows, easy to accomplish. File requesters, message/input boxes, reading clipboard data and getting file checksums are just a few. There are around 100 commands to use and you can edit your script from the built in editor which includes syntax highlighting.

Download Bat To Exe Converter


Slimm Bat To Exe Converter

Using the Slimm batch to executable converter is just about as easy as you could wish to get, but if you want a little more power a couple of extra options are also available. It’s also a portable tool.

slimm bat to exe converter

To quickly create an executable from a batch file that won’t pop up a console window, click the Windowless Express button, browse for the script and it will automatically create the executable file at the same location as the batch file. The Custom button offers the chance to use an integrated text editor where you can also add your own custom icon from the editor’s Tools > Options menu.

Download Slimm Bat To Exe Converter

Create An Executable Batch File Without Extra Software

It is possible to convert a batch script into an executable in Windows without using any third party software at all. This is achieved through the use of an old tool called IExpress that has been around since Windows 2000 and is still there in Windows 10. IExpress creates a self extracting archive that’s designed more for installation packages, but it works for a single batch file as well.

microsoft iexpress

The IExpress Wizard can be used to manually guide you through creating a self extracting package although we have a much easier way of doing it here. Just download the Zip file below and extract the batch file. Then drop your own batch file onto it and in a few seconds, an executable file will be created by IExpress at the same location.

create executable with iexpress

Do note that if your batch file creates output, such as a log file, you need to make sure to set proper paths or any files created will be deleted once the script terminates. While running, the extracted files are stored in %TEMP%. The script was originally created by a user called “npocmaka” on Github and then modified slightly for drag and drop by another user on Stackoverflow.

Download bat2exeIEXP

Create Your Own Executable File

This method is somewhat similar to turning a batch script into an executable, but you create the code and compile the program yourself. For that, a programming or scripting language is required. We have chosen AutoIt but you can use the similar AutoHotkey or something else if you have another favorite.

Here are four lines of AutoIt code to produce a quietly running batch file:

#RequireAdmin
#AutoIt3Wrapper_UseUpx=y
FileInstall(“MyBatchFile.bat”, @TempDir & “\MyBatchFile.bat”,1)
Run(@ComSpec & ” /c ” & @TempDir & “\MyBatchFile.bat”, “”, @SW_HIDE)

run silent batch autoit

The code is simple to understand, line 1 is optional and asks for administrator privileges, line 2 is also optional and compresses the executable. Line 3 embeds MyBatchFile.bat in the executable and extracts it to the Windows Temp folder on launch. The final line runs the batch file as a console command with the hide attribute suppressing the window.

To simplify the process you can compile the executable with just the last line if you want to run a batch file silently that is stored in a permanent location on your computer.

Run(@ComSpec & ” /c ” & “C:\Scripts\MyBatchFile.bat”, “”, @SW_HIDE)

The above will silently execute MyBatchFile.bat from the C:\Scripts folder. To use AutoIt all you have to do is install it or use the portable version, create your code and press F7 to compile. Make sure the batch file to embed is placed in the same folder as the .au3 AutoIt script file.

Download AutoIt (Download the Zip for the portable version)

Run a Silent Batch Script Using a Scheduled Task

This last method is one that doesn’t need any third party tools, only the Windows Task Scheduler is used. All you have to do is point to the batch file and tick a few boxes. This is obviously best for scripts launching on startup, logon or at a specific date and time, although you can also run the task on demand.

1. Go to Control Panel > Administrative Tools > Task Scheduler, or type Task Scheduler into the Start or taskbar search box.

2. Click Create Basic Task and give the task a name, click Next and select when you would like to launch the task.

3. In the Action window leave “Start a program” selected and after clicking Next, browse for the batch script. Add a path to the “Start in” box if you wish to use a different working path for the batch file. Before clicking Finish to close the wizard, check the box to open the properties dialog.

create a basic task

4. In the Properties window select “Run whether user is logged on or not“, you will need to enter the account password when editing is done. If there’s no password on the account, also check the “Do not store password” box. This does have a drawback because the batch script will not be able to access file, folder or printer shares. If you don’t set these options a console window opens while running the script.

run whether user is logged in or not option

5. If the batch script needs administrator privileges, tick the “Run with highest privileges” box. Click OK when done.

create scheduled task with highest privileges

Now you can test the task works by right clicking and selecting Run or waiting for it to run at the scheduled point or time. It should work and without popping up any type of console window.

Running The Scheduled Task On Demand

While the task can be run on the schedule you supplied when creating it, you can also execute it whenever you want. This has an extra bonus because you can run a batch file that requires administrator privileges at any time without having a UAC prompt appear (doesn’t work for standard user accounts).

Create a new shortcut on the desktop and in the location box enter the following:

Schtasks.exe /Run /TN “Task Name”

Replace Task Name with the specific name you gave the task in step two above.

create scheduled tasks shortcut

Now you can run the batch file silently at any time and without any UAC prompts appearing. This method is actually pretty useful for running any type of program silently in the background and without a UAC prompt.

Tip: If you want to run the task on demand only and not with any triggers, go back into the Task Scheduler Properties window (step four above), click the Triggers tab, select the trigger in the list and delete it.

14 Comments - Write a Comment

  1. Alex Gorky 3 weeks ago
    • HAL9000 3 weeks ago
  2. Alex 1 year ago
  3. Yasser 1 year ago
  4. Kiran Vadday 1 year ago
  5. Jeremy 1 year ago
  6. Nagesh 2 years ago
  7. Myself 2 years ago
    • HAL9000 2 years ago
  8. Jeerapong Putthanbut 2 years ago
  9. Squashman 2 years ago
    • HAL9000 2 years ago
  10. Me 2 years ago
  11. Nasser 2 years ago

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: Your comment is subject to approval. Read our Terms of Use. If you are seeking additional information on this article, please contact us directly.