How to find current exe name without using WinSpy

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
deets
Posts: 43
Joined: 29 Mar 2022, 02:00

How to find current exe name without using WinSpy

25 Feb 2024, 17:45

Code: Select all

!f4::
WinGetActiveTitle, windowTitle
WinKill, %windowTitle%
Tooltip, This is working
SetTimer, ToolTipOff, -5000
Return
I'm currently using this, but sometimes I want to use TaskKill on the main program. WinGet only gives me window title or PID, which is not very reliable. How do I get the exe name of the ACTIVE WINDOW so I can kill it?
User avatar
JoeWinograd
Posts: 2214
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: How to find current exe name without using WinSpy

25 Feb 2024, 18:25

deets wrote:get the exe name of the ACTIVE WINDOW
Look at the WinGet doc. For example:

Code: Select all

WinGet,ActiveExeName,ProcessName,A
Regards, Joe
Rohwedder
Posts: 7768
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to find current exe name without using WinSpy

26 Feb 2024, 02:01

Hallo,
or as part of a separate script for tasks that require admin rights:

Code: Select all

#SingleInstance, Force
If !A_IsAdmin
    Run *RunAs "%A_ScriptFullPath%"
!F4::
WinGet, PID, PID, A
WinClose, A,, .5 ; first gently
RunWait, taskkill /pid %PID%,, hide
Return ; then radically

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 299 guests