Home » Questions » Computers [ Ask a new question ]

Run a batch file in a completely hidden way

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..).

Asked by: Guest | Views: 191
Total answers/comments: 5
Guest [Entry]

"Solution 1:

Save this one line of text as file invisible.vbs:

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

To run any program or batch file invisibly, use it like this:

wscript.exe ""C:\Wherever\invisible.vbs"" ""C:\Some Other Place\MyBatchFile.bat""

To also be able to pass-on/relay a list of arguments use only two double quotes

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

Example: Invisible.vbs ""Kill.vbs ME.exe""

Solution 2:

Use a command line tool to silently launch a process : Quiet, hidecon or hideexec."
Guest [Entry]

"Run the script via an at job without making it interactive:

at 11:00 script.bat

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.

Example:

import os

os.system(""tasklist > C:\tasks.txt"")
os.system(""ipconfig /all > C:\netinfo.log"")"
Guest [Entry]

"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:-

cmdow /run /hid mybat arg1 ""arg 2"""
Guest [Entry]

"You can run it minimized easily.

start /MIN batch.cmd"
Guest [Entry]

"You can also create an AutoHotkey script:

#NoTrayIcon ; To prevent momentary icon pop-up
run whatever.bat arg1 arg2,,hide"