用于关闭所有打开的命令提示符窗口的批处理脚本 [英] Batch script to close all open Command Prompt windows

查看:55
本文介绍了用于关闭所有打开的命令提示符窗口的批处理脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .cmd 文件,我调用它来通过以下方式打开 Command Prompt 的多个实例:

I have a .cmd file which I call to open multiple instances of Command Prompt via:

launcher.cmd -fs
launcher.cmd -tds
launcher.cmd -fsd

每个命令都会打开一个新的命令提示符.

Each command open a new command prompt.

所以我要做的是创建一个批处理文件来自动关闭所有打开的命令提示符,而不是手动执行.

So what I want to do is create a batch file to automatically close all the opened Command Prompt instead of manually doing it.

推荐答案

小心:你可能会杀死比你想要的更多的进程:

Be carefull: you might kill more processes than you want:

taskkill /IM cmd.exe

您可以添加额外的过滤器:

You can add extra filters:

taskkill /IM cmd.exe /FI "WINDOWTITLE eq launcher*"

使用

tasklist/FI "imagename eq cmd.exe"/V

了解哪些 cmd.exe 进程将被 taskkill-ed

to get a glimpse of what cmd.exe processes will be taskkill-ed

您可以添加/F 参数来强制关闭进程,但我只会在进程未响应正常请求时使用它.

You could add the /F parameter to force the process to close but I would only use that if the process doesn't respond to a normal request.

这篇关于用于关闭所有打开的命令提示符窗口的批处理脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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