如何使用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"'])