AutoHotkey Community

It is currently May 27th, 2012, 12:42 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Kill a process....
PostPosted: December 20th, 2009, 10:08 pm 
How do I write a script that will kill a process by its process name?
I could write

Code:
run taskkill /f /im firefox.exe


but that will display the CMD prompt. I want to kill the process invisibly.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2009, 10:21 pm 
this may help
http://www.autohotkey.com/forum/topic52458.html


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2009, 11:05 pm 
Offline

Joined: December 1st, 2006, 9:27 am
Posts: 460
Code:
Process, Close, firefox.exe


This will close only the first instance if there are more than one. If you wanted to close all running instances, you could do this:
Code:
Loop
{   Process, Close, firefox.exe
   IfEqual, ErrorLevel, 0, Break   ;if out of targets, exit loop
}
MsgBox, done
If there is a problem with closing one instance, the loop will exit and the rest will not be closed, though. You could parse the list of running processes and close firefox.exe processes only.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Leef_me, Ohnitiel, XstatyK, Yahoo [Bot] and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group