Keep your Windows machine awake from the command line.
nosleep start --duration 30m
|
nosleep start --background --duration 2h
|
nosleep status -w
NoSleep CLI keeps a Windows machine awake for a fixed duration or until you stop
it. It uses the Windows SetThreadExecutionState API to keep the system and
display awake without moving the mouse, pressing keys, or simulating user input.
irm https://raw.githubusercontent.com/Lucu-lucuan-Lab/nosleep-cli/main/install.ps1 | iexRun the following command in PowerShell to download and install the latest release automatically:
irm https://raw.githubusercontent.com/Lucu-lucuan-Lab/nosleep-cli/main/install.ps1 | iexThe installer:
- downloads the binary for the current Windows architecture
- verifies the binary with the release SHA-256 checksum
- installs
nosleep.exeto%LOCALAPPDATA%\Programs\NoSleep - appends the install directory to the User
Path
Open a new terminal after installation, then verify the command location:
where.exe nosleepExpected output:
C:\Users\<you>\AppData\Local\Programs\NoSleep\nosleep.exe
Check the installed version:
nosleep versionRun the installer again to replace the local binary with the latest release:
irm https://raw.githubusercontent.com/Lucu-lucuan-Lab/nosleep-cli/main/install.ps1 | iexIf NoSleep is running in the background, stop it before updating:
nosleep stopStop any active session, then run the uninstaller:
nosleep stop
irm https://raw.githubusercontent.com/Lucu-lucuan-Lab/nosleep-cli/main/uninstall.ps1 | iexThe uninstaller removes nosleep.exe, removes %LOCALAPPDATA%\Programs\NoSleep
from the User Path, and removes NoSleep's local state file.
Download the binary for your architecture from the latest release:
nosleep-windows-amd64.exefor most Windows PCsnosleep-windows-arm64.exefor Windows ARM64
Rename the file to nosleep.exe, place it in a directory on your User Path,
and verify it against checksums.txt from the same release.
Start an open-ended session:
nosleep startRun for a fixed duration:
nosleep start --duration 30m
nosleep start --duration 2h
nosleep start --duration 1h30mRun until a specific 24-hour time:
nosleep start --until 17:30Start in the background:
nosleep start --background --duration 2h
nosleep status
nosleep stopShow the installed version:
nosleep versionAttach a label to the session:
nosleep start --duration 45m --mode MonitoringStop the session with q, esc, or Ctrl+C.
| Flag | Default | Description |
|---|---|---|
--duration |
none | Session duration such as 30m, 2h, or 1h30m. |
--until |
none | Auto-stop time in 24-hour format, such as 17:30. |
--background |
false |
Start NoSleep without keeping the terminal open. |
--mode |
generic |
Optional label displayed for the current session. |
For compatibility, nosleep --duration 30m still starts a foreground session.
Only one background session is allowed at a time.
Requirements:
- Windows
- Go 1.26.2 or newer
Build from source:
go build -o nosleep.exe .\cmd\nosleepRun checks:
go test .\...Releases are built by GitHub Actions from version tags:
git tag v0.1.1
git push origin v0.1.1The release workflow runs tests, builds Windows amd64 and arm64 binaries,
writes SHA-256 checksums, and attaches the installer and uninstaller scripts to
the GitHub release.
