How to sleep

DamianWayne 25 Reputation points
2026-08-17T03:14:46.21+00:00

How to use command line to put windows 10 to sleep after a determined period of time

Windows for home | Windows 10 | Sleep and Power on, off
0 comments No comments

Answer accepted by question author
Marcin Policht 106.8K Reputation points MVP Volunteer Moderator
2026-08-17T03:21:03.6666667+00:00

You can use the powercfg command in Command Prompt to configure Windows 10 to automatically go to sleep after a specified period of inactivity. This is different from starting a one-time countdown that puts the PC to sleep at a particular time.

Open Command Prompt as administrator by opening Start, typing cmd, right-clicking Command Prompt, and selecting Run as administrator.

To set the sleep timeout when the PC is plugged into AC power, use:

powercfg /change standby-timeout-ac <minutes>

For example, to make Windows sleep after 30 minutes of inactivity:

powercfg /change standby-timeout-ac 30

If the computer is running on battery power, use:

powercfg /change standby-timeout-dc <minutes>

For example:

powercfg /change standby-timeout-dc 30

A value of 0 means that Windows will never automatically go to sleep for that power mode.

If, instead, you want to start a countdown and have the PC sleep after a specific amount of time, Windows does not have a native single command equivalent to shutdown -s -t for sleep. You can combine the timeout command with a sleep command. For example, to wait 30 minutes and then put the PC to sleep:

timeout /t 1800 /nobreak && rundll32.exe powrprof.dll,SetSuspendState 0,1,0

Here, 1800 represents 1,800 seconds, or 30 minutes. You can substitute whatever number of seconds you want. For example, 10 minutes is 600 seconds:

timeout /t 600 /nobreak && rundll32.exe powrprof.dll,SetSuspendState 0,1,0

There is a caveat with rundll32.exe powrprof.dll,SetSuspendState - its behavior can be affected by whether hibernation is enabled. A commonly used variation is:

timeout /t 1800 /nobreak && powercfg -h off && rundll32.exe powrprof.dll,SetSuspendState 0,1,0

powercfg -h off disables hibernation and changes the system's hibernation configuration, so I would not use that to create a temporary sleep countdown unless you specifically want hibernation disabled.


If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

hth

Marcin

Was this answer helpful?

2 people found this answer helpful.

0 additional answers

Sort by: Newest

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.