0

I have a requirement that enable autosleep in batch file. The reason is i want to autosleep my computer after getting off work, but disable autosleep when i'm on duty

  • I know how to auto wake up my computer by using RTC in BIOS
  • I know how to run a batch at certain time by using scheduler

The only thing I don't know is how to enable or disable autosleep by batch.

3

1 Answer 1

1

What I want is to set autosleep time

Use powercfg.

Examples

Set timeout to 5 minutes:

powercfg -x standby-timeout-ac 5

Set timeout to never:

powercfg -x standby-timeout-ac 0

Syntax

powercfg [Options]

...

-change setting value
-x setting value

Modify one of the following settings in the current power scheme:
          -monitor-timeout-ac minutes
          -monitor-timeout-dc minutes
          -disk-timeout-ac minutes
          -disk-timeout-dc minutes
          -standby-timeout-ac minutes
          -standby-timeout-dc minutes
          -hibernate-timeout-ac minutes
          -hibernate-timeout-dc minutes

Setting any value to 0 will set the timeout=Never

AC settings are used when the system is on AC power. 
DC settings on battery power.

Source powercfg


Further Reading

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .