如何使用python更改Windows的关机消息? [英] How to change the shutdown message for Windows using python?

查看:19
本文介绍了如何使用python更改Windows的关机消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序可以关闭我的计算机,但我想更改显示的消息.目前,它说我的电脑将在一分钟内关闭;这是在一个消息框中.有没有办法做到这一点?另外,作为额外的功劳",我是否有可能进行实时倒计时?(60 秒、59 秒、58 秒……?)

I have a program which shuts down my computer, but I want to change the message that is displayed. Currently, it says that my computer will shut down in one minute; this is in a messagebox. Is there any way of doing this? Also, as 'extra credit' is it at all possible for me to have a live countdown? (60 sec, 59 sec, 58 sec...?)

我当前的关机代码是这样的:

My current shutdown code is this:

import subprocess
subprocess.call(["shutdown", "-f", "-r", "-t", "10"]) 

我希望将消息嵌入到子流程命令中.

I would like the message to be embedded in the subprocess commands.

规格:

Python 2.7.3Windows 7,32 位

Python 2.7.3 Windows 7, 32 bit

推荐答案

您尝试了吗?

import subprocess
subprocess.call(["shutdown", "-f", "-r", "-t", "10", "-c", '"MESSAGE HERE"'])

这篇关于如何使用python更改Windows的关机消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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