[RESOLVED] Closing multiple instances of a program in task manager.
I am running multiple instances of a program on my computer.
I would like to be able to kill all processes called ... "asdf.exe" for example.
If there were ten instances of "asdf.exe" in task manager, I would like to kill them all with a click of a button.
I can execute 30 instances of a program but cannot kill them all.
Re: Closing multiple instances of a program in task manager.
search the forum.. this has been discussed before... im sure something helpful would come up.
Re: Closing multiple instances of a program in task manager.
Quote:
Originally Posted by some1uk03
search the forum.. this has been discussed before... im sure something helpful would come up.
You're sure something helpful will come up? You dont sound too sure. I am familiar with vbforums etiquette ("searching" before asking)
Thanks for killing my thread.
I highly doubt too many people were looking to kill multiple instances via task manager in the past.
You seem to be trying to increase your post count rather then help people.
Anyway - Can anyone help me out here?
Re: Closing multiple instances of a program in task manager.
Sorry my inner New Yorker go a hold of me.
Re: Closing multiple instances of a program in task manager.
enumerate all windows, if the window belongs to an instance of the program you want to kill then get the Process ID of the window, open the process and all terminate process lastly close the handle.
Re: Closing multiple instances of a program in task manager.
try this piece of code...this should work for you
vb Code:
Dim Process As Object
For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = asdf.exe'")
Process.Terminate
Next Process
Re: Closing multiple instances of a program in task manager.
Quote:
Originally Posted by ganeshmoorthy
try this piece of code...this should work for you
vb Code:
Dim Process As Object
For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = asdf.exe'")
Process.Terminate
Next Process
Thanks for this.
I'm getting an "automation error" though and the programs dont close?
I put your code into a button and have two instances of asdf.exe running..
Re: Closing multiple instances of a program in task manager.
Im sorry, I missed single quote before the name...try this...
vb Code:
For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name='smss.exe'")
Process.Terminate
Next Process
Re: Closing multiple instances of a program in task manager.
Quote:
Originally Posted by ganeshmoorthy
Im sorry, I missed single quote before the name...try this...
vb Code:
For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name='smss.exe'")
Process.Terminate
Next Process
Haha, yes! I just found it and then saw that you found it as well.
Rep Points! Thread resolved.
Re: [RESOLVED] Closing multiple instances of a program in task manager.
erbio: you are most welcome