Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Calls WshShell.Exec with c and kills the process tree after the specified timeout t
- ' Returns the created WshScriptExec object
- Function Exec(c, t)
- Dim s, e : Set s = CreateObject("WScript.Shell") : Set e = s.Exec(c)
- Do While e.Status = 0
- Call s.Run("waitfor /t 1 OneSecond", 0, True)
- t = t - 1
- If 0 >= t Then
- Call s.Run("taskkill /t /f /pid " & e.ProcessId, 0, True)
- Exit Do
- End If
- Loop
- Set Exec = e
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement