我有一个类似这样的Visual Basic脚本:
Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run " cmd.exe", 8, True
运行它会出现此错误:
--------------------------- Windows Script Host --------------------------- Script: D:\Folder\MyScript.vbs Line: 2 Char: 1 Error: Unable to wait for process. Code: 80020009 Source: WshShell.Run --------------------------- OK ---------------------------
我确实打开了一个资源管理器窗口。
为什么会这样?
答案 0 :(得分:1)
命令以空格(或vbTab
)开头。只需将其修剪掉一切就可以了。
答案 1 :(得分:1)
试试这样:
Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run "cmd /k",1,True
或类似的东西:
Set WshShell = CreateObject("Wscript.Shell")
Command = "Ipconfig /all"
WshShell.Run "cmd /k " & Command & "",1,True