Shutting down Windows PC via MetaCard--solved

xbury.cs at clearstream.com xbury.cs at clearstream.com
Fri Feb 14 03:11:01 EST 2003


Tominjapan,

in case it might help, there is another tool here
http://www.aumha.org/freeware.php

Xavier ;))

-----Original Message-----
From: Thomas McCarthy [mailto:tominjapan at excite.com]
Sent: Friday, February 14, 2003 00:42
To: metacard at lists.runrev.com
Subject: RE: Shutting down Windows PC via MetaCard--solved



Thanks to  Scott and xbury.cs
I've been able to do it with commands found on the web page which xbury.cs
provided.

http://www.aumha.org/a/shtrstrt.php

Below is a copy of the important stuff copied from the site.
Cheers
tom mccarthy

For Windows 9x, there are two sets of commands you can use to accomplish
these tasks: The Short Version, and the Long Version. Both are given below.
(Only the Short Version works in Win95.) A quite different method is then
given for use with Windows XP.


The Short Version (Win 9x)

The shortcut command line should be as follows:


For a shortcut to RESTART Windows:
C:\WINDOWS\RUNDLL.EXE user.exe,exitwindowsexec
For a shortcut to SHUT DOWN Windows:
C:\WINDOWS\RUNDLL32.EXE user,exitwindows



The Long Version (Win 98/ME)
Tip from Bill Blanton & MS-MVP George Aker. See also MSKB Q234216.

The command line should be as follows:


C:\WINDOWS\RUNDLL32 SHELL32.DLL,SHExitWindowsEx n 

Where n is one of the following values, depending on the task you want to
accomplish: 

n=0	LOGOFF: Shuts down all running processes, logs the user off, then
restarts the Windows shell. (Same as Logoff on the Start Menu.)
n=1	SHUTDOWN: Shuts down the system to a point at which it is safe to
turn off the power. All file buffers have been flushed to disk, and all
running processes have stopped.
n=2	REBOOT: Shuts down the system, then restarts it. (Same as Start Menu
| Shutdown | Restart.)
n=4	FORCE: Forces all processes to terminate Ñ in effect, shuts down all
running programs. When this flag is set, Windows does not query running
applications to inform them that Windows is shutting down. This can cause
the applications to lose data, therefore, you should only use this flag in
an emergency.
n=8	POWEROFF: Exits Windows, then turns off the computerÕs power
(provided the computer supports the power-off feature).
n=-1	RESTART EXPLORER: Quickly closes Explorer (i.e., the Windows
desktop), then lets it restore itself.

These values are additive, in the event you want to do two of them at once.
There are varying reports of success with some of these options. For
example, inconsistent behavior reported with option 8 may indicate a
different behavior with the powerdown system on a particular computer. The
solution for this usually is to request both a shutdown and a poweroff by
using n=9 (adding the 1 and 8). (Tip from MS-MVP Tom Porterfield.)

This command can also be called from the RunOnce registry entry (which means
these could be written into Registry files as one means of execution).

Additionally, there is a command (which can be run from a shortcut, batch
file, or command prompt) runonce.exe -q, which restarts the computer after a
15 second delay. There are no other options when using this command line,
and it cannot be called from the RunOnce registry key.


Shutdown & Restart Shortcuts for Windows XP & Windows 2000

Windows XP has an actual shutdown command that can be launched from a
command prompt Ñ and which, therefore, also can be launched from a shortcut.
To see all available options for this command, click Start, click Run, and
type:

SHUTDOWN /?

This command starts a 30-second countdown for a shutdown or restart, which
permits you to abort it (with a shutdown -a command). It you want the
command to execute, use the -t flag, which lets you set the time lapse in
seconds. The examples below use a 1-second delay.


For a shortcut to RESTART Windows XP:
SHUTDOWN -r -t 01
For a shortcut to SHUT DOWN Windows XP:
SHUTDOWN -s -t 01


Unfortunately, this option only shuts down Windows. It does not shut down
your computer, at least on most hardware. For that, on Win XP (and possibly
on Win 2000) I recommend the freeware utility Shutdown.exe (not to be
confused with the Windows XP utility by the same name) by MS-MVP Andrej
Budja. IÕve seen several shutdown utilities recommended, but this is the
only one that IÕve seen actually shut down Windows XP and then powerdown the
computer behind it. For more information on the tool, see here. After you
place this utility in the root folder of C:, the commands for a shutdown or
restart (respectively), each without a time delay, would be shutdown -u -t 0
for shutdown and shutdown -r -t 0 for restart.

If you donÕt want to use a third-party utility, you may be able to get by
with a lesser known utility in Windows 2000 and Windows XP. The native
commandline tool tsshutdn.exe was originally designed for shutting down
servers, not work stations. It was introduced in Windows 2000, and retained
in Windows XP. See MSKB Q320188, ÒHow to Use the TSSHUTDN Command to Shut
Down a Terminal Server in Windows 2000 Terminal Services,Ó and MSKB Q243202,
ÒWindows 2000 Terminal Services Session Management Tools.Ó From a command
prompt, type tsshutdn /? for a list of its subcommands and syntax. A command
line of C:\WINDOWS\SYSTEM32\TSSHUTDN.EXE 0 /DELAY:0 /POWERDOWN will
powerdown most Windows 2000 and Windows XP computers, though some (according
to correspondent Òperris,Ó who first turned us onto this native utility)
will get an error message 1702.

Another solution for Windows XP users involves using the power switch on
your computer Ñ but only after youÕve set it to shutdown Windows first! If
you poweroff your computer without shutting down Windows (and letting your
applications save their data and close, if necessary), you invite a whole
lot of serious problems! The correct way to do this is: After a fresh reboot
of the computer, in the Windows XP Control Panel click Power Options. Click
the Advanced tab. In the Power Buttons section, under ÒWhen I press the
power button on my computer,Ó select ÒShutdown.Ó (If this is not visible on
your Advanced tab, then your computer does not have the hardware capability
to do this job correctly, or the capability is disabled in CMOS.) Click
Apply. This sets your computer so that when you press the hardware power
button it will first do a proper shutdown of Windows, and then poweroff the
computer.

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
_______________________________________________
metacard mailing list
metacard at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/metacard


Visit us at http://www.clearstream.com
                                                          
IMPORTANT MESSAGE

Internet communications are not secure and therefore Clearstream International does not accept legal responsibility for the contents of this message.

The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Any views expressed in this e-mail are those of the individual sender, except where the sender specifically states them to be the views of Clearstream International or of any of its affiliates or subsidiaries.

END OF DISCLAIMER



More information about the metacard mailing list