A persistent, configuration-driven process manager for Windows. It ensures a list of specified applications are always running. If a monitored process is not found, ProcGuard will automatically launch it.
It is written in AutoHotkey.
- Persistent Process Monitoring: Runs silently in the background to ensure your essential applications are always active.
- Configuration-Driven: Manage which applications to monitor and how often using a simple
.conffile. - Flexible Launch Commands: For each process, you can specify a simple executable name or a full command with a path and arguments.
- Live Configuration Reload: Automatically reloads the configuration file, allowing you to change settings without restarting the script.
- Optional Logging: Create an empty
procguard.logfile in the same directory to enable detailed logging of the script's actions. - Normal or Reverse Mode: For each entry, choose whether to run the command when the process is missing (default) or when it is present (reverse mode).
- De-elevated Launch (
userflag): Optionally launch a target at normal (Medium) integrity even when ProcGuard itself runs elevated. This keeps global hotkeys working under Windows UIPI (see De-elevated Launch).
There are no command-line arguments for now. All configuration is handled by the procguard.conf file.
- Configure: Create and edit the
procguard.conffile in the same directory asprocguard.ahk. - Run: Simply execute
procguard.ahk. It will run silently in the background.
Create a text file named procguard.conf in the same directory as the executable. The script will not run without it.
- Each line represents one process to monitor.
- Lines starting with
#are ignored as comments.
The format for each line is a comma-separated list:
ProcessName.exe,PathToExecutable [with arguments],IntervalSeconds[,Flag[,Flag]]
-
ProcessName.exe: The name of the process to check for (e.g.,notepad.exe). -
PathToExecutable [with arguments]: The full command to run based on the chosen mode. This can include a full path and any command-line arguments. -
IntervalSeconds: The number of seconds to wait between checks for this specific process. -
Flag(optional, repeatable): Zero or more flags in any order. Supported flags:reverse: reverse mode – run the command when the process is running (default is to run when it is not running).user: de-elevated launch – start the target at normal (Medium) integrity via the Windows Explorer shell, even when ProcGuard runs elevated. See De-elevated Launch below.
Any field that is not a recognized flag is ignored, so existing single-
reverseconfigurations remain valid. Flags may be combined, e.g....,3600,reverse,user.
# ======= # Follow the format below to set the configuration # Executable binary name to be checked, path to the exe to be started, interval (seconds), optional flags # Flags (any order, repeatable): # "reverse" → run when process IS running (default: run when NOT running) # "user" → launch de-elevated (Medium integrity) so global hotkeys work # ======= # Ensure GoldenDict is running, check every 10 minutes (600 seconds) # Normal mode (default): if GoldenDict.exe is missing, start it GoldenDict.exe,C:\Path\to\GoldenDict\GoldenDict.exe,600 # Ensure Listary is running, check every 10 minutes Listary.exe,C:\Path\to\ListaryPortable\Listary.exe,600 # Run a command with arguments, check every 4 hours (14400 seconds) WeaselDeployer.exe,C:\Path\to\RimeIMEPortable\weasel\WeaselDeployer.exe /sync,14400 # Keep a simple background utility active, check every minute CoffeeBean.exe,C:\Path\to\CoffeeBean.exe,60 # Reversed behavior # When Everything.exe IS running, execute the command every 10 minutes Everything.exe,C:\Path\to\Everything.exe -reindex -startup,3600,reverse # De-elevated launch: start a hotkey app at normal integrity so its global # hotkeys keep working even though ProcGuard itself is elevated. bageshuo.exe,C:\Path\to\bageshuo\bageshuo.exe,60,user
By default, a process launched by ProcGuard inherits ProcGuard's integrity level. If ProcGuard is started by an elevated parent (for example an Administrator terminal, or an elevated editor/launcher), it runs at High integrity, and so does everything it starts.
This causes a subtle problem for apps that register global hotkeys. Windows enforces UIPI (User Interface Privilege Isolation): a hotkey registered by a High-integrity process is generally blocked from firing while a normal, Medium-integrity window (your browser, editor, Explorer, etc.) has focus. The symptom is that the app works when launched by double-clicking its icon (Medium integrity) but its hotkey silently stops working when launched by ProcGuard (High integrity).
The user flag fixes this. Instead of launching the target directly, ProcGuard asks the already-running, unelevated Windows Explorer shell to launch it. The target then inherits Explorer's Medium integrity token — exactly as if you had double-clicked it — so its global hotkeys work normally.
Notes:
- Only add
userto targets that should run at normal privilege. Do not use it for tools that genuinely require Administrator rights. - Because the launch is delegated to Explorer, ProcGuard does not receive the child's PID; it continues to track the target by process name on its normal interval, so monitoring and restart still work.
- If no Explorer window is available, ProcGuard falls back to a direct launch (which may run elevated) and records a warning in the log.
To compile the procguard.ahk script into procguard.exe, you will need the AutoHotkey compiler (Ahk2Exe), which is included with the standard AutoHotkey v1.1 installation.
This project is licensed under the MIT License. See the LICENSE file for details.