public sub Main()
Set objShell = CreateObject("WScript.Shell")
strCommand = "C:/Program Files/s/schedule.exe"
objShell.Run strCommand, vbHide, True
Unload Me
end sub它应该用来运行schedule.exe hidden....but程序崩溃
Runtime error '-2147024894 (80070002)' :
method '~' of object '~' failed基本上,我需要schedule.exe在不中断用户的情况下静默运行。
发布于 2010-02-14 19:18:38
如果你有一个对Windows Script Host Object Model的引用,你会得到这个更具描述性的错误消息:
Automation error
The system cannot find the file specified. 这可能会提示您,如果可执行文件名包含如下空格,则必须对其进行引号:
Public Sub Main()
Dim objShell As Object ' WshShell
Dim strCommand As String
Set objShell = CreateObject("WScript.Shell")
strCommand = "C:/Program Files/7-zip/7z.exe"
objShell.Run """" & strCommand & """", vbHide, True ' WshHide
End Sub发布于 2010-02-15 17:50:57
您不需要使用WScript:只需使用带有vbHide参数的Shell函数。
Shell "C:\Program Files\s\schedule.exe", vbHidehttps://stackoverflow.com/questions/2260435
复制相似问题