2

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

3
  • I believe the flag -c "MESSAGE HERE" works. So ["shutdown", "-f", "-r", "-t", "10", "-c \"MESSAGE HERE\""]? Commented Feb 8, 2013 at 1:46
  • 1
    Instead of coming to SO to ask question after question about each flag of the shutdown command (which takes you an hour to get an answer), why not either read the docs at MSDN or type help shutdown at your console? Commented Feb 8, 2013 at 2:08
  • @adchilds I just tried ["shutdown", "-f", "-r", "-t", "10", "-c \"MESSAGE HERE\""] and it did not work. Instead, I got a command prompt console which appeared and then disappeared. Commented Feb 8, 2013 at 3:17

1 Answer 1

2

Did you try?

import subprocess
subprocess.call(["shutdown", "-f", "-r", "-t", "10", "-c", '"MESSAGE HERE"'])
Sign up to request clarification or add additional context in comments.

1 Comment

Why do you need the -f? I was able to do the same thing without it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.