I had a Visual Basic script with something like this:
Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run " cmd.exe", 8, True
Running it gave this error:
--------------------------- Windows Script Host --------------------------- Script: D:\Folder\MyScript.vbs Line: 2 Char: 1 Error: Unable to wait for process. Code: 80020009 Source: WshShell.Run --------------------------- OK ---------------------------
I did get an Explorer window opened.
Why is this?
The command starts with a space (or a vbTab
). Just trim it off and all will be fine.
Try like this :
Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run "cmd /k",1,True
Or something like this :
Set WshShell = CreateObject("Wscript.Shell")
Command = "Ipconfig /all"
WshShell.Run "cmd /k " & Command & "",1,True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With