有什么方法可以编写 Windows .bat 文件来终止进程? [英] Any way to write a Windows .bat file to kill processes?

查看:20
本文介绍了有什么方法可以编写 Windows .bat 文件来终止进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我打开公司拥有的开发机器时,我都必须使用任务管理器或任何其他进程管理应用程序杀死 10 多个进程,才能从我的 IDE 中获得不错的性能.是的,这些是我公司为了安全和合规性而安装在我的机器上的程序的进程.我想要做的是有一个 .bat 文件或某种脚本,我可以用它来终止有问题的进程.

Every time I turn on my company-owned development machine, I have to kill 10+ processes using the Task Manager or any other process management app just to get decent performance out of my IDE. Yes, these are processes from programs that my company installs on my machine for security and compliance. What I'd like to do is have a .bat file or script of some kind with which I can kill the processes in question.

有人知道怎么做吗?

推荐答案

您可以使用taskkill"来完成此操作.使用/IM 参数,您可以指定图像名称.

You can do this with 'taskkill'. With the /IM parameter, you can specify image names.

示例:

taskkill /im somecorporateprocess.exe

您也可以这样做以强制"杀死:

You can also do this to 'force' kill:

示例:

taskkill /f /im somecorporateprocess.exe

只需为要杀死的每个进程添加一行,将其另存为 .bat 文件,然后添加到您的启动目录中.问题解决了!

Just add one line per process you want to kill, save it as a .bat file, and add in your startup directory. Problem solved!

如果这是一个遗留系统,PsKill 也会这样做.

If this is a legacy system, PsKill will do the same.

这篇关于有什么方法可以编写 Windows .bat 文件来终止进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆