Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim procName, procPath, waitSeconds
- procPath = "%WINDIR%\System32\"
- procName = "Notepad.exe"
- waitSeconds = 30
- WScript.Sleep waitSeconds*1000
- sComputerName = "."
- Set objWMIService = GetObject("winmgmts:\\" & sComputerName & "\root\cimv2")
- sQuery = "SELECT * FROM Win32_Process"
- Set objItems = objWMIService.ExecQuery(sQuery)
- 'iterate all item(s)
- Dim procRunning
- procRunning = False
- For Each objItem In objItems
- If objItem.Name = procName Then
- procRunning = True
- End If
- 'WScript.Echo "Process [Name:" & objItem.Name & "]"
- Next
- If procRunning = False Then
- CreateObject("WScript.Shell").Run "%comspec% /c start """" """ & procPath & procName & """", 0, True
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement