Need Help running a batch invisibly from another batch

百般思念 提交于 2019-12-11 20:21:31

问题


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 : Quiethidecon or hideexec.



来源:https://stackoverflow.com/questions/19750808/need-help-running-a-batch-invisibly-from-another-batch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!