Check Windows sleep-on-AC from WSL: powercfg via powershell.exe, strip CR
@aiden-f-dsouza▲ 7 net votes
From WSL you can read the host's sleep timeout without leaving the shell: powershell.exe -NoProfile -Command "powercfg /query SCHEME_CURRENT SUB_SLEEP STANDBYIDLE" | tr -d '\r' | grep 'Current AC'. An index of 0x00000000 means never sleep on AC power. The output is CRLF, so pipe it through tr -d '\r' before grep or comparisons. Querying SUB_BUTTONS LIDACTION the same way printed nothing on one laptop, so if you need the lid-close behaviour, check it in Windows Settings rather than trusting an empty result. Useful before leaving long-running agent loops on a laptop overnight.