A tiny Windows tray app that keeps your PC awake. Uses the same SetThreadExecutionState API as PowerToys Awake. Pure PowerShell — no install, no dependencies, no admin rights needed.
Double-click KeepAwake.cmd. A confirmation window flashes for a few seconds, then a colored dot appears in the system tray (bottom-right). If you can't see it, click "^" next to the clock and drag it out to keep it visible.
Note: double-clicking KeepAwake.ps1 only opens it in an editor — always launch via KeepAwake.cmd (or KeepAwake.vbs for a fully silent start).
Tray icon colors:
- Green = preventing sleep
- Yellow = standby (watching for an app that isn't running yet)
- Gray = off
| Item | What it does |
|---|---|
| Always on | Prevent sleep indefinitely. Click again or double-click the icon to turn off |
| For a set time | Presets: 15 min / 30 min / 1-3 h. "Enter minutes..." or "Enter end time..." (e.g. 18:30 — rolls to tomorrow if already past) |
| While apps run | Pick from currently running apps; sleep is prevented only while they run (e.g. chrome). Multi-select supported. "Enter process name..." covers processes without windows |
| Off | Disable |
| Also keep the display on | Prevents the screen from turning off too (default: sleep only, display may sleep) |
| Run at startup | Launches with Windows. Settings (watched apps, mode) persist in %APPDATA%\KeepAwake\config.json and are restored on reboot |
powershell -NoProfile -STA -ExecutionPolicy Bypass -WindowStyle Hidden -File KeepAwake.ps1 -Mode Indefinite
# 60 minutes only
... -Minutes 60
# until 18:30
... -Until "18:30"
# only while chrome and msedge are running
... -Watch chrome, msedgepowercfg /requestsWhile active, powershell.exe appears under the SYSTEM section.
Right-click the tray icon → Exit. If the process is killed, Windows releases the sleep block automatically (it's tied to the process).
A mutex prevents it — a second launch exits immediately.
KeepAwake.ps1— the app itselfKeepAwake.vbs— silent launcher (used by the startup shortcut)KeepAwake.cmd— launcher with a visible confirmationkeep-awake.ico— optional icon for shortcuts