vb.net - Killing Two different Processes With VB -


i trying figure out how kill 2 processes @ same time have managed 1 work when opened other wont close.

  sub block()     each item process in process.getprocesses         if item.processname = "taskmgr" , item.processname = "cmd"             item.kill()         end if     next end sub 

as noted @noodles , @zaggler logic wrong on line;

  if item.processname = "taskmgr" , item.processname = "cmd" 

this line asks if process name "taskmgr" , if same process name "cmd". since these 2 strings aren't same "taskmgr" /= "cmd" if clause never true. suggest this;

sub block()   each item process in process.getprocesses     if item.processname = "taskmgr"         item.kill()     elseif item.processname = "cmd"         item.kill()     end if   next end sub 

or optionally if plan close many processes;

'declare @ form loading or elsewhere dim proclist new list (of string) proclist.add("taskmgr") proclist.add("cmd") proclist.add("...")  sub block()   each item process in process.getprocesses     if proclist.contains(item.processname)          item.kill()     end if   next end sub 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -