windowsvbscript

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?


Solution

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