Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to wait for process

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?

like image 492
Michel de Ruiter Avatar asked Oct 15 '15 11:10

Michel de Ruiter


2 Answers

The command starts with a space (or a vbTab). Just trim it off and all will be fine.

like image 136
Michel de Ruiter Avatar answered Sep 17 '22 12:09

Michel de Ruiter


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
like image 23
Hackoo Avatar answered Sep 18 '22 12:09

Hackoo