Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- processList = CrashPlanDesktop.exe|CrashPlanService.exe
- ; If the script is not elevated, relaunch as administrator and kill current instance:
- full_command_line := DllCall("GetCommandLine", "str")
- if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
- {
- try ; leads to having the script re-launching itself as administrator
- {
- if A_IsCompiled
- Run *RunAs "%A_ScriptFullPath%" /restart
- else
- Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
- }
- ExitApp
- }
- Loop, parse, processList, |
- {
- Process, wait, %A_LoopField%, 2
- PID = %ErrorLevel%
- if PID = 0
- continue
- ;MsgBox Found pid "%PID%"
- Process, priority, %PID%, Low
- Process, priority, , High
- Process, Close, %PID%
- Run, %comspec% /c "taskkill /F /PID %PID% /T"
- if ErrorLevel
- MsgBox Unable to close process ID %PID%
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement