运行计划任务后将计算机置于待机状态,但前提是必须唤醒才能运行它 [英] Put computer in standby after running a scheduled task but only if it had to wake up to run it

查看:73
本文介绍了运行计划任务后将计算机置于待机状态,但前提是必须唤醒才能运行它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个计划任务,我想每隔几个小时运行一次.如果计算机当前处于待机状态,我希望它唤醒,运行任务,然后重新进入睡眠状态.如果计算机当前处于开启状态,我希望它运行任务但不重新进入睡眠状态,因为那会很烦人.

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?

推荐答案

我刚刚意识到一种方法是运行 powercfg -lastwake

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.

这是正常的输出:

C:\Users\will>powercfg -lastwake
Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Fixed Feature
    Power Button

这篇关于运行计划任务后将计算机置于待机状态,但前提是必须唤醒才能运行它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆