问题
I have A batch file named x.bat, i need it to run y.bat invisibly This is x.bat
@ECHO off
echo CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False>invisible.vbs
wscript.exe invisible.vbs y.bat
y.bat
@ECHO off
dir>good.txt
pause
When i run x.bat it is creating invisible.vbs but it is not opening y.bat invisibly How to overcome this problem
回答1:
Solution 1: Modify your file.
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.
来源:https://stackoverflow.com/questions/19750808/need-help-running-a-batch-invisibly-from-another-batch