Results 1 to 10 of 10

Thread: [RESOLVED] Closing multiple instances of a program in task manager.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Resolved [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.

  2. #2
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    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.
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    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?

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    Re: Closing multiple instances of a program in task manager.

    Sorry my inner New Yorker go a hold of me.
    8 gigs/ram (hey why not)
    300 gig HD x2
    Windows XP 64

  5. #5
    Addicted Member
    Join Date
    Jul 2006
    Location
    Adelaide, Australia
    Posts
    204

    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.

  6. #6
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Closing multiple instances of a program in task manager.

    try this piece of code...this should work for you
    vb Code:
    1. Dim Process As Object
    2.     For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = asdf.exe'")        
    3.         Process.Terminate
    4.     Next Process
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    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:
    1. Dim Process As Object
    2.     For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name = asdf.exe'")        
    3.         Process.Terminate
    4.     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..

  8. #8
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Closing multiple instances of a program in task manager.

    Im sorry, I missed single quote before the name...try this...
    vb Code:
    1. For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name='smss.exe'")
    2.         Process.Terminate
    3.     Next Process
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2006
    Posts
    395

    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:
    1. For Each Process In GetObject("winmgmts:").ExecQuery("Select Name from Win32_Process Where Name='smss.exe'")
    2.         Process.Terminate
    3.     Next Process
    Haha, yes! I just found it and then saw that you found it as well.

    Rep Points! Thread resolved.
    8 gigs/ram (hey why not)
    300 gig HD x2
    Windows XP 64

  10. #10
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: [RESOLVED] Closing multiple instances of a program in task manager.

    erbio: you are most welcome
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width