Skip to content

Commit b8380f0

Browse files
web-flowclaude
andcommitted
Initial release — killall v1.0.0
Windows 11 process termination tool with pattern matching, port/module/window/cmdline filters, CPU/RAM hog detection, LLM/game/hung subcommands, process tree kill, and restart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0 parents  commit b8380f0

8 files changed

Lines changed: 1303 additions & 0 deletions

File tree

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Compiled objects and binaries
2+
*.obj
3+
*.pdb
4+
*.ilk
5+
*.exp
6+
*.lib
7+
*.idb
8+
*.ipdb
9+
*.iobj
10+
11+
# Build output logs
12+
build_out.txt
13+
build_err.txt
14+
15+
# Visual Studio
16+
.vs/
17+
*.vcxproj
18+
*.vcxproj.filters
19+
*.vcxproj.user
20+
*.sln
21+
22+
# Release archives (generated, not tracked)
23+
*.zip
24+
*.7z
25+
26+
# OS
27+
Thumbs.db
28+
desktop.ini
29+
.DS_Store
30+
31+
# The compiled .exe IS tracked so users can download without building
32+
# If you want to exclude it, uncomment:
33+
# killall.exe

README.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# killall — Windows Process Termination Tool
2+
3+
A fast, feature-rich `killall` command for Windows 11, written in C++.
4+
Kill processes by name, pattern, port, DLL, window title, CPU/RAM usage, and more.
5+
6+
---
7+
8+
## Features
9+
10+
| Capability | Description |
11+
|---|---|
12+
| Pattern matching | Exact, substring, glob (`*`/`?`), regex (`/pattern/`) |
13+
| Process tree | Kill a process and all its children with `--tree` |
14+
| Port targeting | Kill whatever is holding a port or port range |
15+
| DLL/module matching | Kill processes that have a specific DLL loaded |
16+
| Window title | Kill by visible window title |
17+
| CPU hog | Sample and kill processes exceeding a CPU threshold |
18+
| RAM hog | Kill processes over a memory limit |
19+
| Hung apps | Detect and kill frozen/unresponsive windows |
20+
| LLM/AI killer | Kills Ollama, LM Studio, Fooocus, KoboldCPP, etc. |
21+
| Game killer | Kills Steam, Epic, Xbox, Ubisoft Connect, and running games |
22+
| Restart | Kill and relaunch a process |
23+
| Self-protection | Never kills itself |
24+
| Colour output | ANSI colour with dry-run safety net |
25+
26+
---
27+
28+
## Quick Start
29+
30+
Download `killall.exe` from [Releases](../../releases), drop it anywhere in your PATH, done.
31+
32+
Or build from source — see [Building](#building).
33+
34+
---
35+
36+
## Usage
37+
38+
```
39+
killall <pattern> [options]
40+
killall <subcommand> [options]
41+
```
42+
43+
### Pattern Matching
44+
45+
| Syntax | Type | Example |
46+
|---|---|---|
47+
| `notepad` | Substring (case-insensitive) | matches `notepad.exe` |
48+
| `note*` | Glob wildcard | matches `notepad.exe`, `notepadpp.exe` |
49+
| `/^steam/` | Regex | matches processes starting with `steam` |
50+
51+
### Options
52+
53+
```
54+
-t, --tree Kill process and all its children
55+
-f, --force Skip confirmation prompt
56+
-n, --dry-run Show what would be killed without killing
57+
--cmdline <pat> Match command-line substring or /regex/
58+
--module <dll> Match processes with a specific DLL loaded
59+
--port <N|A-B> Match processes using a TCP/UDP port or range
60+
--window <title> Match by visible window title (substring or /regex/)
61+
--parent <pid|name> Match children of a specific parent process
62+
--top <N> Limit ramhog/cpuhog to top N offenders
63+
--sample <N> CPU sampling duration in seconds (default: 2)
64+
-h, --help Show help
65+
```
66+
67+
### Subcommands
68+
69+
```
70+
hung Kill hung/frozen applications
71+
networkapps Kill all processes with network connections
72+
ramhog <MB> Kill processes using more than N MB of RAM
73+
cpuhog <percent> Kill processes using more than N% CPU (per core)
74+
gpu [--threshold N] Kill processes using the GPU
75+
llm Kill local AI/LLM processes
76+
game Kill games, launchers, and gaming services
77+
restart <name> Kill a process then relaunch it
78+
```
79+
80+
---
81+
82+
## Examples
83+
84+
```bat
85+
:: Kill all Notepad windows
86+
killall notepad
87+
88+
:: Kill Chrome and every child process it spawned
89+
killall chrome --tree
90+
91+
:: See what's on port 8080 before killing it
92+
killall --port 8080 --dry-run
93+
killall --port 8080 --force
94+
95+
:: Kill anything holding a port range
96+
killall --port 3000-3010 --force
97+
98+
:: Kill by command-line content (useful for Python scripts)
99+
killall --cmdline fooocus --force
100+
killall --cmdline /server\.py$/ --force
101+
102+
:: Kill processes with a specific DLL loaded
103+
killall --module msedge.dll --dry-run
104+
105+
:: Kill by window title
106+
killall --window "Untitled" --force
107+
108+
:: Kill all children of a process
109+
killall --parent explorer --dry-run
110+
111+
:: Kill the top 3 RAM hogs over 500 MB
112+
killall ramhog 500 --top 3 --dry-run
113+
114+
:: Kill CPU hogs over 80% (per core), sampling for 3 seconds
115+
killall cpuhog 80 --sample 3 --top 5
116+
117+
:: Kill all local LLMs (Ollama, LM Studio, KoboldCPP, Fooocus, etc.)
118+
killall llm --force
119+
120+
:: Kill all games and launchers (Steam, Epic, Xbox, Ubisoft, etc.)
121+
killall game --force
122+
123+
:: Kill and restart a process
124+
killall restart explorer
125+
126+
:: Kill hung/frozen applications
127+
killall hung --force
128+
```
129+
130+
---
131+
132+
## LLM / AI Detection
133+
134+
`killall llm` detects AI processes by:
135+
136+
- **Process name:** `ollama`, `lm studio`, `koboldcpp`, `jan`, `gpt4all`, `oobabooga`, `localai`, `vllm`, `whisper`, and more
137+
- **Command line:** `.gguf`, `.ggml`, `.safetensors`, `.ckpt` model files
138+
- **Command line:** `fooocus`, `comfyui`, `webui.py`, `stable-diffusion`, `invokeai`, `kohya`, and others
139+
140+
## Game Detection
141+
142+
`killall game` detects games by:
143+
144+
- **Process name:** `steam`, `epicgameslauncher`, `xboxpcapp`, `upc`, `galaxyclient`, `blizzard`, `eadesktop`, `riotclientservices`, `minecraft`, and more
145+
- **Loaded DLLs:** `steam_api64.dll`, `unityplayer.dll`, `easyanticheat.dll`, `nvngx_dlss.dll`, `bink2w64.dll`, and others
146+
147+
---
148+
149+
## Building
150+
151+
### Requirements
152+
153+
- Windows 10/11
154+
- [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) with **Desktop development with C++** workload
155+
(or just the free **Build Tools for Visual Studio 2022**)
156+
157+
### Build
158+
159+
```bat
160+
git clone https://github.com/YOUR_USERNAME/killall-windows
161+
cd killall-windows
162+
build.bat
163+
```
164+
165+
### Install
166+
167+
```bat
168+
:: Run as Administrator for system-wide install (System32)
169+
:: Or run as normal user for per-user install (~\AppData\Local\Programs\killall)
170+
install.bat
171+
```
172+
173+
---
174+
175+
## How It Works
176+
177+
| Feature | Windows API Used |
178+
|---|---|
179+
| Process enumeration | `CreateToolhelp32Snapshot` |
180+
| Process termination | `TerminateProcess` |
181+
| Process tree | `PROCESSENTRY32.th32ParentProcessID` traversal |
182+
| Command line | WMI `Win32_Process.CommandLine` |
183+
| Loaded modules | `CreateToolhelp32Snapshot (TH32CS_SNAPMODULE)` |
184+
| Network ports | `GetExtendedTcpTable` / `GetExtendedUdpTable` (IPv4 + IPv6 + UDP) |
185+
| Window title | `EnumWindows` + `GetWindowText` |
186+
| Hung detection | `SendMessageTimeout(WM_NULL, 2000ms)` |
187+
| Memory usage | `GetProcessMemoryInfo` |
188+
| CPU usage | Two-snapshot `GetProcessTimes` delta |
189+
| GPU detection | Checking for D3D/DXGI/Vulkan/CUDA DLL presence |
190+
| Process restart | `QueryFullProcessImageNameW` + `ShellExecuteA` |
191+
192+
---
193+
194+
## Notes
195+
196+
- Processes running as **SYSTEM** (e.g. `gamingservices.exe`, `steamservice.exe`) require running killall as **Administrator** to terminate
197+
- `killall` never kills its own process (self-protection built in)
198+
- All pattern matching is case-insensitive
199+
- `cpuhog` reports per-core CPU percentage (same as Task Manager per-process view)
200+
201+
---
202+
203+
## License
204+
205+
MIT

build.bat

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@echo off
2+
setlocal
3+
4+
:: ── Locate MSVC ──────────────────────────────────────────────────────────────
5+
set VCVARS=
6+
for %%E in (Community BuildTools Enterprise Professional) do (
7+
if exist "C:\Program Files\Microsoft Visual Studio\2022\%%E\VC\Auxiliary\Build\vcvars64.bat" (
8+
set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\%%E\VC\Auxiliary\Build\vcvars64.bat"
9+
goto :found
10+
)
11+
)
12+
echo ERROR: Visual Studio 2022 not found. Install MSVC or Build Tools from:
13+
echo https://visualstudio.microsoft.com/downloads/
14+
exit /b 1
15+
:found
16+
17+
call "%VCVARS%" >nul 2>&1
18+
19+
set SRC=%~dp0killall.cpp
20+
set OUT=%~dp0killall.exe
21+
22+
echo Building killall.exe ...
23+
24+
cl.exe /nologo /O2 /W3 /EHsc /std:c++17 /Fe:"%OUT%" "%SRC%" ^
25+
/link psapi.lib iphlpapi.lib wbemuuid.lib ^
26+
ole32.lib oleaut32.lib advapi32.lib shell32.lib
27+
28+
if %ERRORLEVEL% == 0 (
29+
echo.
30+
echo Build succeeded: %OUT%
31+
echo Run install.bat to add killall to PATH.
32+
) else (
33+
echo.
34+
echo Build FAILED - check errors above.
35+
exit /b 1
36+
)
37+
38+
endlocal

install.bat

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
@echo off
2+
setlocal
3+
4+
set SRC=%~dp0killall.exe
5+
6+
if not exist "%SRC%" (
7+
echo ERROR: killall.exe not found. Run build.bat first.
8+
exit /b 1
9+
)
10+
11+
:: ── Try System32 (requires admin) ────────────────────────────────────────────
12+
copy /Y "%SRC%" "%SystemRoot%\System32\killall.exe" >nul 2>&1
13+
if %ERRORLEVEL% == 0 (
14+
echo Installed to %SystemRoot%\System32\killall.exe
15+
echo killall is now available system-wide.
16+
goto :done
17+
)
18+
19+
:: ── Fallback: user bin in AppData ─────────────────────────────────────────────
20+
set USERBIN=%LOCALAPPDATA%\Programs\killall
21+
if not exist "%USERBIN%" mkdir "%USERBIN%"
22+
copy /Y "%SRC%" "%USERBIN%\killall.exe" >nul 2>&1
23+
24+
:: Add to user PATH if not already there
25+
powershell -NoProfile -Command "
26+
\$p = [Environment]::GetEnvironmentVariable('PATH','User')
27+
if (\$p -notlike '*%USERBIN%*') {
28+
[Environment]::SetEnvironmentVariable('PATH', \$p + ';%USERBIN%', 'User')
29+
Write-Host 'Added to user PATH: %USERBIN%'
30+
} else {
31+
Write-Host 'Already in PATH'
32+
}
33+
"
34+
35+
echo.
36+
echo Installed to %USERBIN%\killall.exe
37+
echo Open a new terminal and run: killall --help
38+
39+
:done
40+
endlocal

0 commit comments

Comments
 (0)