I have a VBScript that triggers tests in HP ALM to be run with UFT
- This vbs works only by triggering it in cmd
with cscript
.
I want to know how I can refrain from first going to cmd
to trigger it, but just create another vbs that will trigger the file to be run in cmd
with cscript
. Or maybe you have a better solution.
The below code does not work.
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "cmd.exe" "" c:\Windows\SysWOW64\cscript.exe C:\Temp\Unattended.vbs""
Set oShell = Nothing
Here are a couple of examples how to run the VBS. If your system runs cscript by default the last option should work.
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""")