Shutdown computer (from command line?)

A

Alain Dekker

Hi,

I know about the command prompt "shutdown" command to shut down a PC. If I
use the setting below, it shuts down the PC in 10 seconds with a nice
message:

shutdown -s -t 10 -c "This is a nice message about why I'm shutting you
down"

The problem is that my computer just powers down and what I'd like to do is
get that message at the end which says "It is now safe to turn your PC off".

Any idea how I achieve that?

Thanks,
Alain
 
Z

_Z

Alain Dekker said:
Hi,
I know about the command prompt "shutdown" command to shut down a PC.
If I use the setting below, it shuts down the PC in 10 seconds
with a nice message:
shutdown -s -t 10 -c "This is a nice message about why
I'm shutting you down"
The problem is that my computer just powers down and what I'd like
to do is get that message at the end which says
"It is now safe to turn your PC off".
Any idea how I achieve that?
Thanks,

Alain,
Your mission, should you accept it, is to make a .BAT file.

@ECHO OFF
ECHO As usual, this message will self-destrct in ten sconds!
SLEEP 9
shutdown -s -t 1 -c "It is now safe to turn your PC off. Hurry, before it's too late! You lose."
 
A

Alain Dekker

Amusing reply! Except I already know how to write batch files (and thats
actually how I got the shutdown to work with its message - except I gave the
user 10 second to type "shutdown -a"!).

The original post, though, does ask a specific question which your reply
does not address:

How do I get Windows to shut down Windows XP (I'm using SP3) and then
display the "It is now safe to turn your PC off" message? The shutdown DOS
command doesn't appear to supply me with this functionality, but I've
definitely seen some computers (older motherboards?) do this.

Regards,
Alain
 
R

R. McCarty

The message about "Safe to turn off..." is when a system is not ACPI
compliant. Older APM machines will show that during a Shutdown.
Not sure you can have an ACPI computer shutdown in that way.
 
J

John John (MVP)

_Z said:
Alain,
Your mission, should you accept it, is to make a .BAT file.

@ECHO OFF
ECHO As usual, this message will self-destrct in ten sconds!
SLEEP 9
shutdown -s -t 1 -c "It is now safe to turn your PC off. Hurry, before it's too late! You lose."

AFAIK the Sleep command is not part of the standard Windows XP
installation, it would have to be obtained from the Server 2003 Resource
Kit, or use another method to "sleep" your batch file.

John
 
A

Alain Dekker

Aah, OK, its starting to fit together. Is there any chance you know of to
temporarily fool Windows into thinking its a non-ACPI motherboard
(programatically in Delphi/C++, etc) just before the shutdown. Windows could
then display my "Safe to shut down..." message. I would then re-teach
Windows the true nature of the motherboard on the next boot-up.

Seems a bit of a fudge for the issue but I've my reasons due to the nature
of the application.

Thanks,
Alain
 
R

R. McCarty

Wish I could help, but all my coding experience was years ago and those
neurons have likely been overwritten with more mundane/everyday data.
Anything beyond an "If-then-Else" would be beyond my capabilities.
 
Z

_Z

_Z said:


John John (MVP) said:
AFAIK the Sleep command is not part of the standard Windows
XP installation, it would have to be obtained from the
Server 2003 Resource Kit, or use another method to "sleep"
your batch file.

John,
Yes, I have 2003 ResKit, which explains why SLEEP works for me.
 
A

Alain Dekker

A workaround I found a while back (and its works well) for the "Sleep"
command is to write a batch file called "Wait.bat". The DOS code in this
batch file is:

@ping 127.0.0.1 -n 2 -w 1000 > nul
@ping 127.0.0.1 -n %1% -w 1000 > nul

Put the Wait.bat batch file in a location that will be found by the OS (eg.
<WINDIR>\System32). Now in your next batch file, to wait 9 seconds you
simply write this line:

call Wait 9

However, this is all somewhat off-topic - _Z gave a facetious reply which
was amusing but was not relevant. I still haven't found out how to get
Windows to give the "Safe to switch off..." message but further
investigations appear to have tracked it down to a feature of the
motherboard called ACPI. If the motherboard is non-ACPI, Windows displays
this message, otherwise it doesn't.

There does not appear to be an easy way to get Windows to display the
message on ACPI motherboards...

Regards,
Alain
 
I

Ian D

Alain Dekker said:
Amusing reply! Except I already know how to write batch files (and thats
actually how I got the shutdown to work with its message - except I gave
the user 10 second to type "shutdown -a"!).

The original post, though, does ask a specific question which your reply
does not address:

How do I get Windows to shut down Windows XP (I'm using SP3) and then
display the "It is now safe to turn your PC off" message? The shutdown DOS
command doesn't appear to supply me with this functionality, but I've
definitely seen some computers (older motherboards?) do this.

Regards,
Alain
Since the ATX standard was adopted, the OS turns off the power
supply via the motherboard, as the last step when the Shutdown
procedure is executed. Pre ATX, the OS couldn't do this, therefore
the safe to shutdown message appeared after the OS terminated.
 
Z

_Z

Alain Dekker said:
... _Z gave a facetious reply which was amusing but was not relevant.
I still haven't found out how to get Windows to give the
"Safe to switch off..." message but further
investigations appear to have tracked it down to a feature of the
motherboard called ACPI. If the motherboard is non-ACPI, Windows displays
this message, otherwise it doesn't.
There does not appear to be an easy way to get Windows to display the
message on ACPI motherboards...

Alain,
Sure there is.
Why not just write a VBscipt to display an Alert that spoofs a
shutdown alert, complete with a script timeout, and, if necessary,
actually launch shutdown.exe?
 
I

Ian D

_Z said:
Alain,
Sure there is.
Why not just write a VBscipt to display an Alert that spoofs a
shutdown alert, complete with a script timeout, and, if necessary,
actually launch shutdown.exe?

The problem with any script like that, is XP is still running while
giving the message, and you still shouldn't cut the power until
it quits. With the safe to shut down message the OP was referring
to, you could kill power immediately because the OS had already
terminated.
 
A

Alain Dekker

Thanks Ian D,

That is indeed the problem - once Windows XP complete the shut down, power
is killed to the motherboard and there is not more message yo can display to
the user.

I'm just going to live with the issue by display a message to the user as
the computer shuts down. It would be a nice feature if you could do this.

Thanks for the replies,
Alain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top