批处理脚本杀死最后一个应用程序 [英] batch script to kill last application

查看:139
本文介绍了批处理脚本杀死最后一个应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个批处理脚本,当通过键盘快捷键启动该脚本时,它将使用taskkill /f /im强制退出我上次使用的上一个应用程序.

I would like to create a batch script, which when launched by a keyboard shortcut, will use taskkill /f /im to force quit the last application I was on.

我认为这可能可以通过将最后一个应用程序的名称作为变量,然后将其杀死(该变量)来解决,但我不熟悉批处理,并且不知道应用程序/进程在Windows中的工作方式.任何帮助将不胜感激.

I think that this could probably work by getting the last app's name as a variable, and then killing it (that variable), but I'm unfamiliar with batch, and don't know how applications/processes work in Windows. Any help would be greatly appreciated.

我尝试使用以下脚本,该脚本是从

I've tried using the following script, which I got from here, but unfortunately that didn't work.

Pause::
WinGet,win_pid,PID,A
Run,taskkill /f /pid %win_pid%,,,
return

推荐答案

使用AutoHotKey

您需要安装autoHotKey才能使用此脚本.

Using AutoHotKey

You need to install autoHotKey in order to use this script.

您可以@ https://www.autohotkey.com/

下载并安装后,请查看文档

After you download and install it, have a look at the documentation.

我认为您应该阅读前三部分,因为这对您有所帮助:

I think you should go through the first 3 sections since it will be beneficial for you to understand:

  • 脚本如何工作
  • 如何编辑它们
  • 如何运行它们

这实际上是5分钟的阅读时间.

It's really a 5 minute read.

这篇关于批处理脚本杀死最后一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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