user1540444
user1540444

Reputation: 11

I want to kill exe from Task Manager

i have one exe,when this exe is called ,some this is exe is already open in task manager,i want kill all previous exe not current exe,i am using VB.net

Upvotes: 0

Views: 384

Answers (2)

Rob
Rob

Reputation: 3853

Set your program up to receive messaging. When the most current instance launches have it send a message to the previous instance to itself shutdown gracefully - and of course put the code in place to do this.

Upvotes: 0

chrisb
chrisb

Reputation: 2210

As previous commenters have noted, you really should make more of an effort to solve the problem yourself (and demonstrate you've tried already)

Saying that, here are a few hints:

taskkill.exe /F /IM myprocess.exe /FI "PID ne 555"

Process.GetProcessesByName

Process.GetCurrentProcess

Process.Kill

Be very careful killing processes. As Anton Kovalenko noted already, are you really sure you want to do it? It may be better to simply warn of the condition and provide instruction to the user/admin.

Upvotes: 1

Related Questions