睡眠关机脚本

来源:互联网 发布:python中文编码问题 编辑:程序博客网 时间:2024/05/01 12:55
import os
import time


running = True


command = "shutdown /s"


command_time = "ping 127.0.0.1 -n 10>nul"


print time.strftime('%H%M')


while running:
    if time.strftime('%H%M') == "1100":

        if os.system(command) == 0:
            print 'Successful shutdown the system'
        else:
            print 'shutdown FAILED'
    else:

os.system(command_time)

利用python脚本,可以设定在晚上11点休息,技术改变生活!

原创粉丝点击