Autohotkey 如果程序已打开,请将其关闭

Autohotkey 如果程序已打开,请将其关闭,autohotkey,Autohotkey,如果程序是打开的,我正在尝试各种关闭程序的方法,但只能使用第三种方法 if WinExist("ahk_exe exe.exe") WinClose SetTitleMatchMode, 2 if WinExist("Partial Window Title") WinClose if WinExist("Window Title") WinClose 确保您试图终止的进程不是后台进程 如果是,请尝试使用Process 例如: Process, Exist, exe.e

如果程序是打开的,我正在尝试各种关闭程序的方法,但只能使用第三种方法

if WinExist("ahk_exe exe.exe")
    WinClose
SetTitleMatchMode, 2
if WinExist("Partial Window Title")
    WinClose
if WinExist("Window Title")
    WinClose

确保您试图终止的进程不是后台进程

如果是,请尝试使用
Process

例如:

Process, Exist, exe.exe
if (Errorlevel != 0)
    Process, Close, exe.exe

您确定所有这些窗口/可执行文件都在运行,并且都是以这些名称运行的吗?您也不能使用
WinExist
关闭后台进程,因为它只允许关闭当前窗口。这就是为什么:与其他方法相关联的程序被最小化到系统托盘。进程命令是唯一的替代方案吗?