Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
April 10, 2005
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]
Where:
BatchFile is the path to the batch file and ParamX are optional parameters.
HideBatch.bat contains:
@echo offif {%1}=={} @echo Syntax: HideBatch BatchFile [Param1 Param2 ... ParamN]&goto :EOFsetlocalset 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%:Runitset param=%*set param="%param:"=```%"cscript //nologo %VBS% %param%endlocal
You May Also Like