简体   繁体   中英

Kill Java process with a vbscript

I have some java processes running and I want to end a certain java process. I have installed jdk so I can use jps.exe [output = PIDNumber Processname] to view the running java tasks. The challenge is that I want to kill a certain processname with a vbscript. So I have to run jps.exe via script and put the output into an array.

Any Hints how to achieve the goal are appreciated! Thanks

you can use PsKill . it can terminate system processes
you have to need to download the executable and place it in the same directory as the script or add it's path in the WshShell.Exec call

我找到了我的问题的答案:

ShellCommandToRun = "jps"
Set objShell = CreateObject("WScript.Shell") Set objExec = objShell.Exec(ShellCommandToRun)
strPingResults = objExec.StdOut.ReadAll
WScript.Echo strPingResults

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM