Talk:KillProc plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Undo revision 17834 by 192.88.212.32 (talk))
 
Line 1: Line 1:
There's a simple alternative to the KillProc plugin on windows. The following example would terminate all processes with the name "ExeToKill.exe"...
There's a simple alternative to the KillProc plugin on windows. The following example would terminate all processes with the name "ExeToKill.exe"...


Your sample plugin syntax would only make sense if the description said :
=== Example ===
 
ExecWait "taskkill /f /im ExeToKill.exe"
$0 the number of processes found/killed
:That application is only present on Windows XP and above. --[[User:Kichik|kichik]] 19:43, 10 March 2009 (UTC)
$1 the number of processes not found/killed #### Request that discription of $1 be revised.
 
The snippet only says 'killed' for $1, so the coding in the section does not make sense that it would only error out on $1 if a process cannot be "killed" (see ##########comment):
 
Section
  StrCpy $0 "foo.exe"
  DetailPrint "Searching for processes called '$0'"
  KillProc::FindProcesses
  StrCmp $1 "-1" wooops ############### Why is $1 being used here if $1 is only for issues with kill?
  DetailPrint "-> Found $0 processes"
  StrCmp $0 "0" completed
  Sleep 1500
  StrCpy $0 "foo.exe"
  DetailPrint "Killing all processes called '$0'"
  KillProc::KillProcesses
  StrCmp $1 "-1" wooops
  DetailPrint "-> Killed $0 processes, failed to kill $1 processes"
  Goto completed
  wooops:
  DetailPrint "-> Error: Something went wrong :-("
  Abort
 
  completed:
  DetailPrint "Everything went okay :-D"
SectionEnd

Latest revision as of 22:29, 10 May 2011

There's a simple alternative to the KillProc plugin on windows. The following example would terminate all processes with the name "ExeToKill.exe"...

Example

ExecWait "taskkill /f /im ExeToKill.exe"

That application is only present on Windows XP and above. --kichik 19:43, 10 March 2009 (UTC)