操作系统重启、关机、休眠、睡眠、唤醒 (Windows Python) [英] OS Reboot, Shutdown, Hibernate, Sleep, Wakeup (Windows Python)

查看:49
本文介绍了操作系统重启、关机、休眠、睡眠、唤醒 (Windows Python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种自动执行 Windows 电源管理功能的方法:- 重启- 关掉- 休眠- 睡觉- 唤醒

I'm looking for an automatize way of doing Windows Power Management functions: - Reboot - Shutdown - Hibernate - Sleep - Wakeup

是否有 Python 模块来涵盖此功能?当然,也欢迎任何其他解决方案...

Is there a Python module to cover this functionality? Of course any other solutions are also appreciated...

推荐答案

我也使用了命令行:

import os
os.system(r'%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernate')

这篇关于操作系统重启、关机、休眠、睡眠、唤醒 (Windows Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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