VBS: Close a java .jar that is running.

Discussion in 'Software' started by Heaney, Oct 5, 2011.

  1. Heaney

    Heaney Private E-2

    Hello.

    So I'm getting decently adept at VBS myself now, able to write basic things and google snippets to use to get better results.

    However, I'm stuck on how I can close a jar in vbs.

    Closing the javaw.exe or java.exe would be fine too.

    Any idea?
     
  2. red death68

    red death68 Command Sergeant Major

  3. Heaney

    Heaney Private E-2

    Code:
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colProcessList = objWMIService.ExecQuery _
        ("SELECT * FROM Win32_Process WHERE Name = 'javaw.exe'")
    For Each objProcess in colProcessList
        objProcess.Terminate()
    Next
    Works

    Just replace "javaw.exe" with what you want to kill.
     
    Last edited: Oct 5, 2011

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds