In Windows, how can I termiante an application if I can't get the task manager to the foreground?
Solution 1:
Use Powershell. Start it as Administrator, then use Get-Process in combination with Stop-Process to list and stop processes/tasks. To list the tasks/processes:
Get-Process
To list the processes that are not responding:
Get-Process | Where { !$_.Responding }
To stop non-responding tasks:
Get-Process | Where { !$_.Responding } | Stop-Process -Force
To stop tasks based on task ID, first get the processes. Note the ID of the process you want to stop, then run the Stop-Process cmdlet. Replace IDofProcess
with the process ID
Get-Process
Stop-Process -PID IDofPRocess -Force
Solution 2:
You can use the free AutoHotkey.
The following script will kill the process owning the active window when pressing Ctrl+Alt+K:
^!k:: ; Ctrl+Alt+K
WinGet, PID, PID, % "ahk_id " WinExist("A") ; Get process owning active window
Process, Close, %PID% ; Close this process
After installing AutoHotKey, put the script in a .ahk
file and double-click
it to test. You may stop the script by right-click on the green H icon in the
traybar and choosing Exit.
To have it run on login, place it in the Startup group at
C:\Users\USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
.
Useful AutoHotkey documentation:
- List of Keys
- Hotkeys