需要的对象:' WshShell'

时间:2017-05-22 18:49:13

标签: vbscript

嘿所有人我试图制作一个简单的VBS脚本,并且我不断收到错误对象:' WshShell'

这是脚本

CreateObject("WScript.Shell").Run "C:\DEXIS\DEXsync.exe"
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}"
WScript.Quit()

我还附上了错误消息。有人请帮助我觉得我正在服用疯狂的药片 error message

1 个答案:

答案 0 :(得分:2)

您需要将正在使用的WshShell变量设置为新的Wscript.Shell对象。尝试这样的事情:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "C:\DEXIS\DEXsync.exe"
WScript.Sleep 1000
WshShell.SendKeys "{ENTER}"
WScript.Quit()