Put computer in standby after running a scheduled

2019-08-31 08:57发布

I have a scheduled task which I want to run every few hours. If the computer is currently in standby, I want it to wake up, run the task, then go back to sleep. If the computer is currently on, I want it to run the task but not go back to sleep, because that would be annoying.

Is there any way of knowing whether a scheduled task had to wake the computer to run?

1条回答
一纸荒年 Trace。
2楼-- · 2019-08-31 09:02

I've just realised one way of doing it which is to run powercfg -lastwake

This is the output when waking to run a task:

C:\Users\will>powercfg -lastwake
Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Wake Timer
    Owner: [SERVICE] \Device\HarddiskVolume5\Windows\System32\svchost.exe (Schedule)
    Owner Supplied Reason: Task Scheduler will execute '\test' task.

This is the output normally:

C:\Users\will>powercfg -lastwake
Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Fixed Feature
    Power Button
查看更多
登录 后发表回答