Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'VBScript to run a process when a specific process (name) is terminated.
- 'Requires Administrator rights.
- '
- 'https://www.reddit.com/user/jcunews1/
- ProcessNameToWait = "notepad.exe"
- ProcessCmdlineToRun = """c:\program files\app\app.exe"" /switch"
- StopScriptAfterProcessRun = false
- ProcessNameToWait = ucase(ProcessNameToWait)
- set sh = createobject("wscript.shell")
- set wmi = getobject("winmgmts:\\.\root\cimv2")
- do while true
- set evs = wmi.execnotificationquery("select * from win32_processstoptrace")
- do while true
- set ev = evs.nextevent
- if ucase(ev.processname) = ProcessNameToWait then
- sh.run ProcessCmdlineToRun, 1
- if StopScriptAfterProcessRun then wscript.quit
- end if
- loop
- loop
Add Comment
Please, Sign In to add comment