#81937 - 2002-03-22 08:11 AM
Shutdown/Restart - options
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
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 line | Effect |
---|
DOS | ECHO G=FFFF:0000 ¦ DEBUG | Reboot (warm boot, sometimes cold boot)(2) | Win31* | ECHO G=FFFF:0000 ¦ DEBUG | Popup Task Manager, sometimes reboot | Win9* | RUNDLL USER.EXE,ExitWindows | Shutdown (3) | Win9* | RUNDLL USER.EXE,ExitWindowsExec | Win95: 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/ME | RUNDLL32 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/ME | RUNONCE.EXE -q | Reboot (4) | NT | See Reboot NT on my Solutions found in alt.msdos.batch page | Reboot immediately | NT | RUNDLL32 USER32.DLL,ExitWindowsEx RUNDLL32 USER32.DLL,ExitWindowsEx | Logoff (most systems require the command to be called twicebefore logging off) | NT+RK | SHUTDOWN /L /R /T:0 /Y | Immediate shutdown & reboot | NT+RK | SHUTDOWN /L /T:10 /Y /C | Shutdown in 10 seconds, close without saving(can be stopped during those 10 seconds usingSHUTDOWN /A ) | XP | SHUTDOWN -r -t 10 | Reboot after a 10 seconds delay(can be stopped during those 10 seconds usingSHUTDOWN -a ) | XP | SHUTDOWN -s -t 01 | Shutdown 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/2 | START /PM SHUTDOWN && EXIT | Shutdown (5) | OS/2 | SETBOOT /IBD:C: | Unconditional shutdown & reboot | OS/2 | SETBOOT /IBA:nonsense | Unconditional shutdown & failing reboot (6) | OS/2 | LOGOFF | Logoff (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/ME | | Windows 98 or Windows Millennium Edition (ME) | | NT | | Windows NT 4 or Windows 2000 | | NT+RK | | Windows NT 4 or Windows 2000 with the appropriate Resource Kit | | XP | | Windows XP | | Kix | | Windows (any) with Kix | | WSH | | Windows Script Host | | OS/2 | | OS/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. |
---|
| 3 | Thanks for Bill James and TomLavedas, for the information on RUNDLL. Find more RUNDLL examples I collected on my RUNDLL page. |
---|
| 4 | See 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. |
---|
| 5 | Will still stop and ask for confirmation if a non-PMapplication is active |
---|
| 6 | Needs 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.
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 ]
|
Top
|
|
|
|
Moderator: Jochen, Radimus, Glenn Barnas, Allen, Arend_, ShaneEP, Mart
|
0 registered
and 128 anonymous users online.
|
|
|