Shutdown and restart methods.

You can get SHUTDOWN.EXE from the NT/2K/XP Resource Kit.

{Edit - Thanks Doc!}
Jorgen Bosman writes a pretty nice utility as well for rebooting systems
Jorgen Bosman homepage

Poweroff is a small program for Win95/98/NT/W2K/XP to schedule a shutdown/reboot/logoff/poweroff/Standby/Hibernate/Lock/Wake-On-LAN at a certain time. I also support command line options that allows poweroff to be used in batch scripts. It has a built-in scheduler, it allows you to run a program before doing the action, you can give a warning message to the user, wait for a process to finish before doing the action and full remote control is supported.

You can download Psshutdown either as as a "stand alone" or in the PStools Kit.

In Kix, you can issue shutdown with the following:
$RC = Shutdown("", "System is being rebooted to enable new settings.", 60, 0, 1)
It does not work well with Windows 9x.

You can do the following though:

SHELL "%windir%\RUNDLL32.EXE user.exe,ExitWindows"

But, wait there's more...

Compliments of http://www.robvanderwoude.com

And specifically....

http://www.robvanderwoude.com/shutdown.html

The following is posted with permission.


Shutdown and Reboot




OS (1)Command lineEffect
DOSECHO G=FFFF:0000 ¦ DEBUGReboot (warm boot, sometimes cold boot)(2)
Win31*ECHO G=FFFF:0000 ¦ DEBUGPopup Task Manager, sometimes reboot
Win9*RUNDLL USER.EXE,ExitWindowsShutdown (3)
Win9*RUNDLL USER.EXE,ExitWindowsExecWin95: various results, usualy fast shutdown (and lock PC), sometimes restart Windows, sometimes reboot.
Win98: Restart Windows, sometimes reboot.
Win9*RUNDLL SHELL.DLL,RestartDialog"System Settings Change, Do you want to restart your computer now?" dialog
Win98/MERUNDLL32 SHELL32.DLL,SHExitWindowsEx n
Where n can be any combination (sum) of the following numbers: (4)
0  Logoff
1  Shutdown
2  Reboot
4  Force
8  Poweroff (if supported by the hardware)
Win98/MERUNONCE.EXE -qReboot (4)
NTSee Reboot NT on my Solutions found in alt.msdos.batch pageReboot immediately
NTRUNDLL32 USER32.DLL,ExitWindowsEx
RUNDLL32 USER32.DLL,ExitWindowsEx
Logoff (most systems require the command to be called twicebefore logging off)
NT+RKSHUTDOWN /L /R /T:0 /YImmediate shutdown & reboot
NT+RKSHUTDOWN /L /T:10 /Y /CShutdown in 10 seconds, close without saving(can be stopped during those 10 seconds usingSHUTDOWN /A)
XPSHUTDOWN -r -t 10Reboot after a 10 seconds delay(can be stopped during those 10 seconds usingSHUTDOWN -a)
XPSHUTDOWN -s -t 01Shutdown after a 1 second delay (but no poweroff)
Kix$RC = SHUTDOWN( "\\server", "Shutting down...", 10, 1, 0 )Shutdown in 10 seconds, with message, close withoutsaving, no reboot
Kix$RC = SHUTDOWN( "\\server", "", 0, 1, 1 )Immediate shutdown & reboot, without a message
Kix$RC = LOGOFF( 1 )Logoff, forcing applications to close (use 0 instead of1 if you don't want to force applications to close)
WSH[1]Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
[2]
[3]
for each OpSys in OpSysSet
[4]    OpSys.Reboot()
[5]next
Reboot
 
(Remove [line numbers].
Found in a forum posting by Alex Angelopoulos on www.developersdex.com)
OS/2START /PM SHUTDOWN && EXITShutdown (5)
OS/2SETBOOT /IBD:C:Unconditional shutdown & reboot
OS/2SETBOOT /IBA:nonsenseUnconditional shutdown & failing reboot (6)
OS/2LOGOFFLogoff (both LAN Server client and Peer)


 

 
Notes:  1  DOS  MS-DOS or PC-DOS
Win31*Windows 3.1, 3.11 or 3.11 for Workgroups
Win9*Windows 95 or 98
Win98/MEWindows 98 or Windows Millennium Edition (ME)
NTWindows NT 4 or Windows 2000
NT+RKWindows NT 4 or Windows 2000 with the appropriate Resource Kit
XPWindows XP
KixWindows (any) with Kix
WSHWindows Script Host
OS/2OS/2 Warp 3 and 4, LAN Server and Warp Server
  2  May not work with "exotic" memory managers, likeQuarterdeck's QEMM or DesqView; in that case, use RESET.COM instead.
3Thanks for Bill James and TomLavedas, for the information on RUNDLL.
Find more RUNDLL examples I collected on my RUNDLL page.
4See article Q234216 in the Microsoft Knowledge base for more information.
Thanks for Alec Soroudi for pointing out this information.
Windows NT also has a RUNONCE.EXE, but I am not sure what itspurpose is -- RUNONCE.EXE -q does not shut down NT.
5Will still stop and ask for confirmation if a non-PMapplication is active
6Needs Boot Manager installed.
Will reboot, no questions asked, and then stop if nonsenseis an invalid Boot Manager menu entry (which, in this case, isexactly what we want).


Use Andrej Budja's XP
Shutdown
replacement if you want to poweroff your computer from the command line.

Didier Cassereau's
Logoff
tool for Windows NT can logoff, shutdown, reboot or power off from the
command line.

Jorgen Bosman's
PowerOff
for all Windows (32-bits) versions can power off, shutdown or reboot
your PC, log you off, lock your workstation, go to standby or hibernation
mode and even wake up another PC.

All actions can be done locally or on a remote PC (if it is running
PowerOff).

The actions can be performed immediately or scheduled, by using its
built-in scheduler.

This tool can be used both as a GUI or as a command line tool.





Solutions found in alt.msdos.batch


and alt.msdos.batch.nt


Reboot Windows NT


(without the need to use the
Resource Kit)




Walter Zackery posted a batch file to reboot Windows NT
without the need to use the Resource Kit:

For NT only:

@ECHO OFF & cd/d %temp% & echo [version] > {out}.inf
(set inf=InstallHinfSection DefaultInstall)
echo signature=$chicago$ >> {out}.inf
echo [defaultinstall] >> {out}.inf
rundll32 setupapi,%inf% 1 %temp%\{out}.inf
del {out}.inf


MAVE <ddlx2@ddlx.ch> wrote in message
news:81tve9$bri$1@unlisys.unlisys.net...
: I want to restart my NT4.0 with a batch file. How can I do it.
:
: With rundll32.exe shutdown /l /y /r dont run!
:
: Thanks
:
--------------------------------------------------------------------
:


For more information on .INF files, see Chapter 18,
Working with .inf Files from the online Windows 2000 Resource Kit

[ 01. April 2003, 09:09: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's