我编写了以下 vbScript 文件来使多个程序延迟自动启动:
'Delay time 50 seconds
WScript.sleep 50000
Set WshShell = WScript.CreateObject("WScript.Shell")
'Google Trans
WshShell.Run "E:\prg\gDesktopTranslator_v1.0\gDesktopTranslator.exe"
WScript.Sleep 2000
'Skype
cmd_1 = chr(34) & "C:\Program Files\Skype\Phone\Skype.exe" & chr(34)
cmd_2 = "/nosplash /minimized"
skype_cmd = cmd_1 & " " & cmd_2
WshShell.Run skype_cmd, 1, True
Set WshShell = Nothing
WScript.Quit
但问题是脚本执行后,WScript 文件仍在内存中:( 我认为 WScript 将被 WScript.Quit 关闭
使用 Exec 方法而不是 Run。
示例:
Dim WshShell, oExec
Set shShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("E:\prg\gDesktopTranslator_v1.0\gDesktopTranslator.exe")
YWE 的答案中缺少一个“W”。 我无法评论,因为我的声誉太低了...
第二行应该是:
Set WshShell = CreateObject("WScript.Shell")