Vbscript 控件在运行命令后不返回原始vbs文件
我正在尝试从另一个调用vbs文件。执行被调用的文件。但是,控件不会返回到原始vbs文件。当我在任务管理器中看到wscript进程时,该文件似乎正在运行。但是我看不到输出——run命令之后的步骤。如有任何帮助/建议,将不胜感激 1.)vbs文件1(原始vbs文件test3.vbs) 2.)vbs文件2(称为vbs文件-test2.vbs) 3.)预期产出:Vbscript 控件在运行命令后不返回原始vbs文件,vbscript,Vbscript,我正在尝试从另一个调用vbs文件。执行被调用的文件。但是,控件不会返回到原始vbs文件。当我在任务管理器中看到wscript进程时,该文件似乎正在运行。但是我看不到输出——run命令之后的步骤。如有任何帮助/建议,将不胜感激 1.)vbs文件1(原始vbs文件test3.vbs) 2.)vbs文件2(称为vbs文件-test2.vbs) 3.)预期产出: in test2 complete - test2 complete test3 4.)实际: objShell.run(“cmd/K C:
in test2
complete - test2
complete test3
4.)实际:
objShell.run(“cmd/K C:\temp\a\test2.vbs”,0,True)
由于/K
开关,永远不会结束:
cmd /?
因此cmd
窗口保持打开状态,但由于intWindowStyle
参数:0=隐藏窗口并激活另一个窗口,假设Run
方法语法模式为.Run(strCommand[intWindowStyle],[bWaitOnReturn])
使用其中一个
strErrorCode = objShell.run("cmd /C C:\temp\a\test2.vbs", 0, True)
或
甚至
strErrorCode = objShell.run("C:\temp\a\test2.vbs", 0, True)
cmd /?
Starts a new instance of the Windows command interpreter
CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
strErrorCode = objShell.run("cmd /C C:\temp\a\test2.vbs", 0, True)
strErrorCode = objShell.run("wscript.exe C:\temp\a\test2.vbs", 0, True)
strErrorCode = objShell.run("C:\temp\a\test2.vbs", 0, True)