Reputation: 11
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
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
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"
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