strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process") Dim objWShell Set objWShell = CreateObject("WScript.Shell") For Each objProcess in colProcesses If objProcess.Name = "Skype.exe" Then Wscript.Echo "Skype find" Wscript.Quit End If Next Wscript.Echo "Skype not find, exec skype" objWShell.Run "cmd /C skypelogin.bat", vbHide, False Set objWShell = Nothing
参考
http://www.microsoft.com/japan/technet/scriptcenter/resources/qanda/aug05/hey0810.mspx