简体   繁体   English

用vbscript杀死Java进程

[英]Kill Java process with a vbscript

I have some java processes running and I want to end a certain java process. 我正在运行一些Java进程,但我想结束某个Java进程。 I have installed jdk so I can use jps.exe [output = PIDNumber Processname] to view the running java tasks. 我已经安装了jdk,因此可以使用jps.exe [output = PIDNumber Processname]来查看正在运行的Java任务。 The challenge is that I want to kill a certain processname with a vbscript. 挑战在于我想用vbscript杀死某个进程名。 So I have to run jps.exe via script and put the output into an array. 因此,我必须通过脚本运行jps.exe并将输出放入数组中。

Any Hints how to achieve the goal are appreciated! 任何提示如何实现目标表示赞赏! Thanks 谢谢

you can use PsKill . 您可以使用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 您需要下载可执行文件并将其与脚本放置在同一目录中,或者将其路径添加到WshShell.Exec调用中

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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