win7设置定时开关机
来源:互联网 发布:可以测三庭五眼的软件 编辑:程序博客网 时间:2024/06/08 18:52
win7设置定时开关机
win7定时开关机
利用休眠来代替关机,然后定时唤醒,再重启
启用休眠
如果执行shutdown -h
提示没有启用休眠功能,则先执行以下命令 powercfg -hibernate on
定时休眠
使用:shutdown -h -f -t 1800
//-t参数对休眠无效,会被任务是错误的命令
正确使用:at 14:00 shutdown -h -f
//14:00强制休眠
定时开机
想使用创建计划任务来唤醒电脑,但是一直不成功,百度的各种方法都试过,后来使用工具WakeupOnStandBy
成功唤醒,wosb.exe 下载地址:https://yunpan.cn/cPtEiiiRVYAaS 访问密码 b08f wosb.exe /closeall
//清空wosb.exe创建的定时任务 wosb.exe /run /systray /ami tm="15:00" file="shutdown.exe" params="-r -f -t 0"
//15:00唤醒,并且唤醒后重启电脑
注意:如果系统没有启用“允许使用唤醒定时器”功能,唤醒将失败,解决方法可参考我的另一篇文章“电源管理”:http://blog.csdn.net/jin_huan11/article/details/51671556
代码示例
void Util::timerShutdown(EMessageType type, QTime exeTime, bool bImmediate){ //时间无效 if(!bImmediate && !exeTime.isValid()) { g_log->logFunc2(LOG_INFO, "shutdown: %d, time %s is invalid.", type , TIME_TO_STRING(exeTime).toUtf8().data()); return; } //计算exexTime距当前的时间 msc int msc = 0; if(!bImmediate) { msc = mescToCurrTime(exeTime); } QString filePath; //关机命令 if(type == EMSG_SHUTDOWN) {#ifndef WAkEUPONSTANDBY filePath = "shutdown -s -t " + QString::number(msc / 1000);#else //用睡眠来代替关机,这样可以使用wakeuponstandby唤醒电脑 //use sleep replace shutdown //shutdown -h -t 1800, "-t" is invalid filePath = "powercfg -hibernate on"; //使用powercfg来启用电脑睡眠功能 Util::startProgram(filePath, false, true); if(bImmediate) { filePath = "shutdown -h -f"; } else { //由于shutdown -h 不能带时间参数, 所以使用at命令操作 filePath = "at /delete /yes"; //清除上一次的at命令 Util::startProgram(filePath, false, true); filePath = "at " + TIME_TO_STRING(exeTime) + " shutdown -h -f"; }#endif } //开机/唤醒命令 else if(type == EMSG_STANDBY) {#ifdef WAkEUPONSTANDBY filePath = "\"" + qApp->applicationDirPath() + "/wosb.exe\""; //close all timer QString commandStr = filePath + " /closeall"; //关闭之前的wosb命令 Util::startProgram(commandStr, false, true); //stand up filePath += " /run /systray /ami tm=" + TIME_TO_STRING(exeTime) + " file=\"shutdown.exe\" params=\"-r -f -t 0\"";#endif } //重启命令 else if(type == EMSG_REBOOT) { filePath = "shutdown -r -f -t " + QString::number(msc / 1000); } bool bShutdown = Util::startProgram(filePath, false, false); g_log->logFunc2(LOG_INFO, "%s result: %d", filePath.toUtf8().data(), bShutdown);}
1 0
- win7设置定时开关机
- win7 系统定时开关机
- win7 定时开关机命令
- Windows定时开关机设置
- Windows系统中设置定时开关机方法
- 定时开关机
- 定时开关机
- 怎么实现定时开关机
- 电脑定时开关机之一
- XP定时开关机
- 定时开关机相关
- Android:android定时开关机
- 开关机定时执行脚本
- win7设置电脑定时关机
- win7如何设置定时关机
- win7 自定义开关机背景图片
- Android之实现定时开关机
- Android之实现定时开关机
- canva基础学习(一)
- Android 实现FlowLayout流式布局(类似热门标签)
- B - I NEED A OFFER!——HOJ 类0-1背包问题 +滚动数组
- 软件包管理(二)
- 数据库mysql 操作 和linux一些记录
- win7设置定时开关机
- Codeforces 319E Ping-Pong (线段树+dsu)
- Service中同一命令执行两次结果不同
- SwipeRefreshLayout
- 关于在Android Studio中使用Assets目录下的资源的问题
- 虚函数和纯虚函数的区别
- 阿里2016校招实习生面经
- Handler、Looper消息传递机制
- mysql_xm