利用VBS脚本后台启动多个程序
Option Explicit
Dim objWMIService,colProcessList,strComputer
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'Program1.exe'")
If colProcessList.Count=0 Then
CreateObject("WScript.Shell").Run "Program1.exe",0
'WScript.Sleep(2500)
'如需在第一个程序启动后延迟启动第二个程序,可以使用上一语句,参数为毫秒
End If
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'Program2.exe'")
If colProcessList.Count=0 Then
CreateObject("WScript.Shell").Run "Program2.exe",0
End If
Set colProcessList = Nothing
Set objWMIService = Nothing
WScript.Quit