延迟程序启动的脚本

时间:2010-11-01 19:34:58

标签: vbscript

我编写了以下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关闭 alt text

1 个答案:

答案 0 :(得分:1)

使用Exec方法代替Run。

示例:

Dim WshShell, oExec
Set shShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("E:\prg\gDesktopTranslator_v1.0\gDesktopTranslator.exe")