A tiny open-source Windows utility that keeps the computer awake while still allowing the display to turn off. It can also lock Windows and then turn the display off while background tasks continue running.
一个轻量的 Windows 开源小工具:防止电脑因空闲自动睡眠,同时允许屏幕熄灭或锁屏。适用于下载、数据处理、脚本、AI Agent、ChatGPT/Codex 等需要长时间后台运行或夜间运行的任务。
- Keep Windows awake while the app is running / 程序运行期间保持 Windows 唤醒
- Allow the monitor to turn off normally / 屏幕仍可按系统设置自动熄灭
- Lock Windows and turn off the display / 一键锁屏并熄屏
- Background tasks continue after lock screen / 锁屏后后台任务继续运行
- Restore normal Windows sleep behavior after exit / 关闭程序后恢复正常睡眠行为
- No administrator privileges required / 不需要管理员权限
- Does not permanently change your Windows power plan / 不永久修改电源计划
- No network access, telemetry, account login, or API keys / 不联网、不遥测、不需要账号或 API Key
Windows 的“关闭屏幕”和“睡眠”是两件不同的事。
StayAwake Windows 在运行时请求系统保持唤醒,但不会强制显示器保持点亮。因此你可以关闭屏幕或锁定 Windows,同时让下载、脚本、数据处理、AI Agent、ChatGPT/Codex 等后台任务继续执行。
StayAwake Windows 适合需要保持电脑运行,但又希望关闭屏幕或锁屏的场景,例如:
- 保持电脑运行,防止 Windows 自动睡眠
- 电脑息屏运行 / 电脑熄屏运行
- 锁屏后项目、脚本或程序继续运行
- 夜间运行长时间任务
- ChatGPT / Codex 长任务夜间运行
- AI Agent、代码生成、数据分析等后台任务持续运行
- 下载任务息屏运行
- 数据处理、批处理任务后台持续运行
- PowerShell 或其他脚本长时间运行
- Windows 不休眠但允许关闭屏幕
如果你正在寻找“如何让电脑不休眠”“如何保持电脑运行”“电脑息屏后任务继续运行”“锁屏后程序继续运行”“项目夜间运行”“ChatGPT/Codex 长任务夜间运行”等解决方案,StayAwake Windows 就是为这类场景设计的。
Windows 不休眠 · 保持电脑运行 · 电脑息屏运行 · 电脑熄屏运行 · 锁屏继续运行 · 项目夜间运行 · ChatGPT 夜间运行 · Codex 后台运行 · AI 长任务运行
keep awake · stay awake · screen off · prevent sleep · long-running tasks · overnight tasks · ChatGPT · Codex · AI agent
StayAwake Windows is an independent open-source utility and is not affiliated with OpenAI, ChatGPT, or Codex.
The utility uses Windows SetThreadExecutionState with:
ES_CONTINUOUSES_SYSTEM_REQUIRED
It intentionally does not set ES_DISPLAY_REQUIRED, so Windows is still allowed to power off the monitor.
The lock-and-screen-off action uses LockWorkStation, waits briefly for the lock screen to settle, and then sends a non-blocking monitor power-off message.
程序通过 Windows SetThreadExecutionState API 请求系统保持唤醒,但不请求屏幕持续点亮,因此显示器仍可熄灭。
- Download the latest release from the GitHub Releases page.
- Extract the ZIP file.
- Double-click
StayAwake.vbs. - Keep the control window open while your task is running.
- When leaving the computer, click “锁屏并熄屏(推荐)”.
- Close the utility when you want Windows to return to its normal sleep behavior.
普通用户建议直接下载 Release 压缩包,无需安装,也不需要管理员权限。
如果 .vbs 被系统策略拦截,可以双击:
Start_Diagnostic.cmd
诊断模式会保留 PowerShell 窗口,方便查看错误。
- 仅关闭屏幕 — turns off the monitor without locking Windows.
- 锁屏并熄屏(推荐) — locks Windows, waits about 1.5 seconds, then turns off the monitor.
- 退出并恢复正常 — exits the utility and clears its keep-awake request.
This utility prevents automatic idle sleep only while it is running.
It does not prevent:
- manually choosing Sleep / Hibernate / Shut down
- power loss
- network, Wi-Fi, or VPN disconnects
- laptop lid-close actions configured to sleep
- system policies that force sleep through other mechanisms
For laptops, if you want background tasks to continue with the lid closed, configure the Windows lid-close action separately.
StayAwake Windows:
- does not access personal files
- does not read browser data
- does not connect to the Internet
- does not collect telemetry
- does not require an account
- does not modify the Windows power plan permanently
See PRIVACY.md.
StayAwake-Windows/
├─ StayAwake.vbs
├─ Start_Diagnostic.cmd
├─ src/
│ └─ StayAwake.ps1
├─ screenshots/
├─ README.md
├─ PRIVACY.md
├─ CHANGELOG.md
├─ RELEASE_NOTES_v1.0.0.md
├─ LICENSE
└─ .gitignore
