JSI Tip 9242. How can I hide a batch window?

Using only built-in tools, I have scripted HideBatch.bat to run a batch script hidden.

The syntax for using HideBatch.bat is:

HideBatch BatchFile \[Param1 Param2 ... ParamN\]


BatchFile is the path to the batch file and ParamX are optional parameters.

HideBatch.bat contains:

@echo off
if \{%1\}==\{\} @echo Syntax: HideBatch BatchFile \[Param1 Param2 ... ParamN\]&goto :EOF
set VBS="%TEMP%\HideBatch.vbs"
if exist %VBS% goto Runit
@echo dim obj, obj1, obj2, objArgument>%VBS%
@echo Set WshShell = WScript.CreateObject("WScript.Shell")>>%VBS%
@echo Set objArgument = Wscript.Arguments>>%VBS%
@echo obj1=objArgument(0)>>%VBS%
@echo obj2=Replace(obj1, "```", """")>>%VBS%
@echo obj = WshShell.Run(obj2, 0)>>%VBS%
@echo set WshShell = Nothing>>%VBS%
set param=%*
set param="%param:"=```%"
cscript //nologo %VBS% %param%

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.