简体   繁体   中英

How to change the shutdown message for Windows using python?

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.

Specs:

Python 2.7.3 Windows 7, 32 bit

Did you try?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM