A tiny Windows PATH environment-variable manager written in Go.
It reads and writes the PATH directly from the Windows registry (so changes
persist across reboots) and broadcasts WM_SETTINGCHANGE so newly launched
processes pick up the change immediately.
- 📋
list— show all PATH entries (user and/or machine scope) - ➕
add/ ➖delete— append/remove an explicit directory - ⚡
register/unregister— add/remove the current directory (justcdsomewhere and runpathutil register) - 🔍
where— check which scope a directory is present in - Case-insensitive matching (Windows paths), idempotent operations
- Persists to registry + notifies the system; no re-login needed for new shells
Download the latest binary from the Releases page, or build from source:
go build -o pathutil.exe .pathutil - Windows PATH management
Usage:
pathutil list List all PATH entries (user + machine)
pathutil add <dir> [--scope machine] Append a directory to PATH
pathutil delete <dir> [--scope machine] Remove a directory from PATH
pathutil where [<dir>] Check where a directory is present
pathutil register [--scope machine] Add the CURRENT directory to PATH
pathutil unregister [--scope machine] Remove the CURRENT directory from PATH
Options:
--scope user|machine Target scope (default: user). "machine" needs admin.
# List everything
pathutil list
pathutil list --scope machine
# Add / remove an explicit directory
pathutil add C:\Tools\bin
pathutil delete C:\Old\Path
# The convenient form: cd into a project, then register it
cd D:\Projects\mytool
pathutil register # now `mytool` is on PATH
pathutil unregister # take it off again
# Where is Go's bin?
pathutil where C:\Go\bin- Changes only affect newly launched processes. The terminal you ran the command in keeps its old environment — open a new one to see the update.
--scope machinewrites toHKLM\...\Environmentand requires the shell to be elevated (Run as administrator). If not elevated,pathutilprints a clear message and exits with code7.- User scope writes to
HKCU\Environmentand needs no special privileges.
pathutil opens the Windows registry key that stores PATH:
| Scope | Registry key |
|---|---|
| user | HKEY_CURRENT_USER\Environment |
| machine | HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment |
It splits the value on ; (ignoring empty entries), performs the add/remove
case-insensitively, writes the value back, then broadcasts
WM_SETTINGCHANGE with lParam = "Environment" so Explorer and other apps
reload their environment.
Requires Go 1.25+ and GOOS=windows (it uses the golang.org/x/sys/windows/registry package).
go build -o pathutil.exe .Releases are produced automatically by the GitHub Actions workflow on every
version tag (e.g. v0.1.0) for windows/amd64 and windows/arm64.
MIT