WScript.Shell 错误“方法”~“对象的“~”失败”
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......但是程序崩溃了,
Runtime error '-2147024894 (80070002)' :
method '~' of object '~' failed
基本上我需要schedule.exe安静地运行而不打扰用户。
public sub Main()
Set objShell = CreateObject("WScript.Shell")
strCommand = "C:/Program Files/s/schedule.exe"
objShell.Run strCommand, vbHide, True
Unload Me
end sub
it's supposed to run schedule.exe hidden....but program crashes with
Runtime error '-2147024894 (80070002)' :
method '~' of object '~' failed
basically i need schedule.exe to run silently without interrupting the user.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您引用了
Windows 脚本宿主对象模型
,您将收到此更具描述性的错误消息:这可能会提示您,如果可执行文件名包含如下空格,则必须引用它:
If you had a reference to
Windows Script Host Object Model
you would get this more descriptive error message:This might clue you that you had to quote the executable filename if it contains spaces like this:
您不需要使用 WScript:只需使用 Shell带有 vbHide 参数的 函数。
You don't need to use WScript: just use the Shell function with the vbHide argument.