我有一个VBScript触发HP ALM中的测试以使用UFT运行
- 此vbs只能通过cmd
cscript
触发它。
我想知道如何避免首先转到cmd
来触发它,而只是创建另一个vbs,它将触发文件在cmd
中cscript
运行。或许你有更好的解决方案。
以下代码不起作用。
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "cmd.exe" "" c:\Windows\SysWOW64\cscript.exe C:\Temp\Unattended.vbs""
Set oShell = Nothing
答案 0 :(得分:0)
以下是一些如何运行VBS的示例。如果您的系统默认运行cscript,则最后一个选项应该有效。
Set objShell = CreateObject("WScript.Shell")
'run with wscript
objShell.Run("""C:\Windows\System32\wscript.exe"" ""C:\Test\MyScript.vbs""")
wscript.sleep 5000 'waits 5 seconds before running the next script. This is used for display purposes, not because you have to
'run with cscript
objShell.Run("""C:\Windows\System32\cscript.exe"" ""C:\Test\My Script.vbs""")
wscript.sleep 5000 'waits 5 seconds before running the next script. This is used for display purposes, not because you have to
'run with the default program for vbs files (usually cscript)
objShell.Run("""C:\Test\My Script.vbs""")