How to run .BAT files invisibly, without displaying the Command Prompt window
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 or .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.
The built-in Task Scheduler in Windows is capable of launching programs in hidden mode. If you don’t want to proceed via the Task Scheduler route, check out the options discussed in this article.
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 hidden (invisible mode) Using Script
Windows Script Host’s Run Method allows you run a program or script in invisible mode. Here is a sample Windows script code that launches a batch file named syncfiles.bat invisibly.
Reference: Run Method. Setting intWindowStyle parameter to 0 hides the window.
-
Copy the following lines to Notepad.
Running .BAT or .CMD files hidden (invisible mode) Using NirCmd
NirCmd is a multipurpose command-line automation utility from the third-party vendor Nirsoft. We’ve covered NirCmd many times in the past on our site.
We can use NirCmd to run a program, script or batch file in hidden mode.
Download NirCmd and extract the file to your Windows directory.
From the Run dialog or Command Prompt, use the following syntax to launch a batch file or program in hidden mode:
Example:
If you need to run the batch file elevated (as administrator), use the following command instead:
That’s it! If you know any other method to run a batch or CMD file in hidden mode, let us know.
One small request: If you liked this post, please share this?
- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!
report this ad
About the author
Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.
48 thoughts on “How to run .BAT files invisibly, without displaying the Command Prompt window”
AutoHotkey can run things hidden too…
Run, somebat.bat, , Hide
…or…
Run, %1%, , Hide
…put the 2nd example in RunHidden.ahk…then add a Run Hidden option to the .bat right-click menu…
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\batfile\Shell\RunHidden\Command]
@=”\”C:\\Program Files\\AutoHotkey\\AutoHotkey.exe\” \”C:\\Program Files\\AutoHotkey\\RunHidden.ahk\” \”%1\” %*”
…I didn’t test that, but I hope you get the idea anyway…also I don’t know if this blog supports…
[code]test[/code]
…tags…so I didn’t use them…& no preview…
You can use the Arguments property to pass command line parameters:
WshShell.Run chr(34) & “C:\Batch Files\syncfiles.bat” & Chr(34) & WScript.Arguments(0), 0
I found it useful to verify the command string before putting it into the script:
WScript.Echo chr(34) & “C:\Batch Files\syncfiles.bat” & Chr(34) & WScript.Arguments(0)
Hope that helps!
Thank you! Worked great, I was using a .cmd script to run every 5 minutes and it was rather annoying that the command prompt window would pop up every 5 minutes to run it. The VBS you gave made it run completely invisible now. Thanks again.
Как запускать файлы .BAT невидимо, не отображая окно командной строки

Пакетные файлы (.BAT) и файлы командных сценариев Windows NT (.CMD) запускаются в окне консоли при двойном щелчке. Это означает, что окно командной строки будет отображаться до завершения выполнения файла .BAT или .CMD.if(typeof __ez_fad_position!=’undefined’)<__ez_fad_position(‘div-gpt-ad-winhelponline_com-box-3-0’)>;
Чтобы сделать выполнение файлов .BAT или .CMD менее навязчивым, вы можете настроить его для минимального запуска. Или, если файл .BAT или .CMD не требует ввода данных пользователем во время выполнения, вы можете запустить его в невидимом режиме с помощью скрипта.if(typeof __ez_fad_position!=’undefined’)<__ez_fad_position(‘div-gpt-ad-winhelponline_com-medrectangle-3-0’)>;
Встроенный в Windows планировщик заданий может запускать программы в скрытом режиме. Если вы не хотите использовать маршрут планировщика заданий, ознакомьтесь с вариантами, описанными в этой статье.
- Запустите пакетный файл или файл CMD в режиме свернутого окна
- Запустите пакетный файл или файл CMD, скрытый (невидимый режим) с помощью сценария Windows
- Запустите пакетный файл или файл CMD, скрытый (невидимый режим) с помощью утилиты NirCmd
Запуск файлов .BAT или .CMD в свернутом режиме
Чтобы запустить командный файл в свернутом состоянии окна, выполните следующие действия:
- Создайте ярлык для файла .BAT или .CMD. Для этого щелкните файл правой кнопкой мыши, выберите «Отправить на рабочий стол» (создать ярлык).
- Щелкните правой кнопкой мыши ярлык и выберите «Свойства».
- В раскрывающемся списке Выполнить: выберите Свернуть.
- Нажмите ОК.
- Дважды щелкните ярлык, чтобы запустить командный файл в свернутом состоянии окна.
Запуск файлов .BAT или .CMD, скрытых (невидимый режим) с помощью скрипта
if(typeof __ez_fad_position!=’undefined’)<__ez_fad_position(‘div-gpt-ad-winhelponline_com-box-4-0’)>;Метод запуска Windows Script Host позволяет запускать программу или сценарий в невидимом режиме. Вот пример кода сценария Windows, запускающего пакетный файл с именем syncfiles.bat незримо.
Ссылка: Метод запуска. Установка для параметра intWindowStyle значения 0 скрывает окно.
Допустим, у нас есть файл с именем syncfiles.bat в C: \ Пакетные файлы каталог. Давайте запустим его в скрытом режиме с помощью сценариев Windows.
-
Скопируйте следующие строки в Блокнот.
Примечание. Замените имя / путь пакетного файла в сценарии соответствующим образом в соответствии с вашими требованиями.
СВЯЗАННЫЕ: Как автоматически повысить уровень командного файла, чтобы запустить его от имени администратора? -и- VBScripts и повышение прав UAC (Запуск от имени администратора)
Запуск файлов .BAT или .CMD, скрытых (невидимый режим) с помощью NirCmd
NirCmd — это многоцелевая утилита автоматизации командной строки от стороннего поставщика Nirsoft. В прошлом мы много раз освещали NirCmd на нашем сайте.
Мы можем использовать NirCmd для запуска программы, сценария или пакетного файла в скрытом режиме.if(typeof __ez_fad_position!=’undefined’)<__ez_fad_position(‘div-gpt-ad-winhelponline_com-large-leaderboard-2-0’)>;
В диалоговом окне «Выполнить» или в командной строке используйте следующий синтаксис для запуска командного файла или программы в скрытом режиме:

Если вам нужно запустить командный файл с повышенными правами (от имени администратора), используйте вместо этого следующую команду:
Вот и все! Если вы знаете какой-либо другой способ запустить пакетный файл или файл CMD в скрытом режиме, сообщите нам об этом.
Running a CMD or BAT in silent mode
How can I run a CMD or .bat file in silent mode? I’m looking to prevent the CMD interface from being shown to the user.
![]()
11 Answers 11
Include the phrase:
right at the top of your bat script.
That should answer your question.
From your first script, call your second script with the following line:
Actually, you are calling a vbs script with:
- the [path]\name of your script
- all the other arguments needed by your script ( %* )
Then, invis.vbs will call your script with the Windows Script Host Run() method, which takes:
- intWindowStyle : 0 means «invisible windows»
- bWaitOnReturn : false means your first script does not need to wait for your second script to finish
See the question for the full invis.vbs script:
Update after Tammen’s feedback:
If you are in a DOS session and you want to launch another script «in the background», a simple /b (as detailed in the same aforementioned question) can be enough:
You can use start /b second.bat to launch a second batch file asynchronously from your first that shares your first one’s window.
![]()
I think this is the easiest and shortest solution to running a batch file without opening the DOS window, it can be very distracting when you want to schedule a set of commands to run periodically, so the DOS window keeps popping up, here is your solution. Use a VBS Script to call the batch file .
Copy the lines above to an editor and save the file with .VBS extension. Edit the .BAT file name and path accordingly.
Use Advanced BAT to EXE Converter from http://www.battoexeconverter.com
This will allow you to embed any additional binaries with your batch file in to one stand alone completely silent EXE and its freeware
Use Bat To Exe Converter to do this
1 — Open Bat to Exe Converter, select your Bat file.
2 — In Option menu select «Invisible Application», then press compile button.
Try SilentCMD. This is a small freeware program that executes a batch file without displaying the command prompt window.
If i want to run command promt in silent mode, then there is a simple vbs command:
if i wanted to open an url in cmd silently, then here is a code:
I’m pretty confident I like this method the best. Copy and paste the code below into a .vbs file. From there you’ll call the batch file. so make sure you edit the last line to specify the path and name of the batch file (which should contain the file you’d like to launch or perform the actions you need performed)
It definitely worked for me. Comments are welcomed 🙂
Another way of doing it, without 3rd party programs nor converters («batch to exe» programs actually just put your batch file in the tmp folder and then run it silently so anyone can just fetch it from there an get your code) no vbs files (because nobody knows vbs) just one line at the beginning of the batch file.
The below silent .bat file code prevents the need to have two bat files (using "goto" and ":").
It does it all in the same .bat file. Tested and confirmed working in Windows 10
Run a batch file in a completely hidden way
I’m looking for some way to run a batch file (.bat) without anything visible to the user (no window, no taskbar name, .etc..).
I don’t want to use some program to do that, I’m looking for something cleaner. I’ve found a solution that uses VBScript, but I don’t really like using VBS, either.
![]()
![]()
20 Answers 20
Solution 1:
Save this one line of text as file invisible.vbs :
To run any program or batch file invisibly, use it like this:
To also be able to pass-on/relay a list of arguments use only two double quotes
Example: Invisible.vbs "Kill.vbs ME.exe"
Solution 2:
Use a command line tool to silently launch a process : Quiet, hidecon or hideexec.
![]()
To Hide batch files or command files or any files. Use Windows XP built in IExpress.exe utility to build a .EXE out of the batch file. When using IExpress make sure you check the run hidden option and check mark all the boxes about not showing anything. After you create your .exe place it in whatever run command folder you choose and you will never see it come up.
I don’t like the VBScript solution.
Download and copy nircmd.exe to your %systemroot%\system32 folder, then add this command to first line of your batch:
You can also change the title of your batch file terminal window by title command to avoid from hiding all cmd windows, like this:
Run the script via an at job without making it interactive:
Another solution, if you don’t mind installing something like Python, you could simply create a script and run it with pythonw (the linked version for GUI operations). Since you aren’t using any graphical APIs, the window will not show. Simply use calls to os.system() and it will mimic a batch script, as it is the same as typing the strings into the command line.
If your Batch File can fit into one line and so many characters, then just use a Shortcut by right clicking inside a folder put in a random directory, and skip through the rest of the wizard, and lastly right click on the shortcut just created and click properties and under target, input what you would usually put in a bat file. And Bobs your uncle!
use Cmdow is a Win32 commandline utility for NT4/2000/XP/2003 that allows windows to be listed, moved, resized, renamed, hidden/unhidden, disabled/enabled, minimized, maximized, restored, activated/inactivated, closed, killed and more.
Run a batch file hidden passing it parameters:-
You can run it minimized easily.
You can also create an AutoHotkey script:
Using Windows7, you can use the «Scheduled Task» control panel to schedule a batch file to run in the background invisibly with specified permissions and even as the «SYSTEM» account. See screenshot below:

Furthermore, although with not as many capabilities, you can also create a invisible batch script task like this from the command line using the «AT.exe» command without the ‘/interactive’ option.
![]()
The excellent Bat To Exe Converter will convert your .bat or .cmd file to an .exe file.

It has a simple UI. You can choose not to have a console window by selecting an Exe Format of XX Bit | Windows (Invisible) option. Also, it allows you to assign an icon, set a password and several other options.
![]()
Despite I’ve already answered this here’s another approach. The different here’s that the batch script can self-hide itself during it’s run.You’ll need two additional scripts though — windowMode.bat and getCMDPid.bat (both are containing .net code). Here how then can be used:
![]()
YET ANOTHER way, from C/C++, is to use the CreateProcess function with the CREATE_NO_WINDOW flag. It has a lot of extra power not shown here. This is just the minimum you need to replace system() or the _spawn() family.
I did it successfully with nircmd this way:
- download nircmd.exe from the link
- create your .bat file
- the first line of .bat file has to be this: nircmd.exe win hide ititle «cmd.exe»
- select both files and create a self extract file using winrar
- in «general» tab, check «create autoextract file» box
- in «advance» tab select «autoextract» button
- there is a new window and select «mode» tab then select option: «hide everything»
- select tab «update» and select option «overwrite existing files»
- Select «general» tab and define a destination folder for extraction if you wish and in the box «Excecute after extraction» write the full path where your .bat will be extracted. Ex: if you define extraction folder as: «c:\windows\» then the full path to excute after extraction will be: «c:\windows\file.bat» (in the case your .bat is named: file.bat)
- click accept on all windows
Now you will have a .exe file that after you doble click on it and install it, your .bat will run totally hidden.
![]()
Adding my answer here from another post since it was a duplicate and I don’t see this solution here so now there are 17 different answers for how you can run a batch file hidden. I will delete my answer on that post at some point in the near future.
Create your batch script with your batch logic and commands in it, and then create a new file with .VBS extension, use the below logic (example I provided below) and just plug in the full path to your .CMD or .BAT file with the PING -t <IPAddress> , etc. commands so it executes the batch in a hidden manner not showing the command window when it is executed.
Where the logic in the example below specifies C:\Folder\BatchFileName.cmd change that to point to the batch script with your commands you are running manually, etc. now.
Save the .VBS file and schedule it with Task Scheduler Problems scheduling a task on windows7 to run on an indefinite schedule for your needs.
Otherwise, just double-click on the .VBS file to run the infinite PING command you put in the batch file you point it to as-needed.
NOTE: I believe this is where I got this script logic from but it works reliably for the same purpose you need here which is to ensure the command window is hidden when a batch file is run Server Fault Source
EXAMPLE VBS SCRIPT RUN COMMAND LINE BATCH HIDING CMD WINDOW
EXAMPLE 2
Note: This looks for a bat file with the same name. You can change bat to cmd in script, if needed with this example.