Jump to content

Shutdown And Reboot


Recommended Posts

HOW-TO GUIDE ON SHUTDOWN, REBOOT & LOGOFF COMMANDS

FOR WINDOWS (ALL) AND DOS

All of us are aware of the "shutdown" command in Windows XP and above, which provides us not only with the option of shutting down silently, but logging off, restarting, and other stuff- like displaying the reason for shutdown or setting a time-delay before shutdown...

But, here are a lot of other ways of doing this in other version of windows and even in the pure DOS environment:

Link to comment
Share on other sites


Windows 95 or 98

Command Line : RUNDLL USER.EXE,ExitWindows

Effect : Shutdown

-----------------------------------------------------------------------

Command Line : RUNDLL USER.EXE,ExitWindowsExec

Remarks :

Win95: various results, usualy fast shutdown (and lock PC), sometimes restart Windows, sometimes reboot.

Win98: Restart Windows, sometimes reboot.

-----------------------------------------------------------------------

Command Line : RUNDLL SHELL.DLL,RestartDialog

Effect : Restart dialog

Remarks : "System Settings Changed, Do you want to restart your computer now?" dialog

Link to comment
Share on other sites

Windows 98

Command Line : RUNDLL32 KRNL386.EXE,exitkernel

Effect : Poweroff

Remarks : Poweroff for ATX boards only, otherwise normal shutdown

-----------------------------------------------------------------------

Command Line: RUNDLL32 SHELL32.DLL,SHExitWindowsEx n

Effect :

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)

-----------------------------------------------------------------------

Command Line : RUNONCE.EXE -q

Effect : Reboot

Link to comment
Share on other sites

NT4+RK, W2K+RK

Command Line : SHUTDOWN /L /R /T:0 /Y

Effect : Reboot

Remarks : Immediate shutdown & reboot

-----------------------------------------------------------------------

Command Line : SHUTDOWN /L /T:10 /Y /C

Effect : Delayed shutdown

Remarks : Shutdown in 10 seconds, close without saving.

Can be stopped during those 10 seconds using SHUTDOWN /A

Link to comment
Share on other sites

Windows NT 4, 2000 or XP

Command Line : PSSHUTDOWN \\mynt4srv -K -F -T 20

Effect : Delayed poweroff

Remarks :

Poweroff \\mynt4srv after a 20 seconds delay

Can be aborted using PSSHUTDOWN \\mynt4srv -A

-----------------------------------------------------------------------

Command Line : PSSHUTDOWN \\myw2ksrv -O -F -T 0

Effect : Logoff

Remarks :

Immediately logoff console user on \\myw2ksrv

-----------------------------------------------------------------------

Command Line : DEVCON Reboot

Effect : Reboot

Link to comment
Share on other sites

Windows XP/Server 2003

Command Line : SHUTDOWN -r -t 10

Effect : Delayed reboot

Remarks :

Reboot after a 10 seconds delay.

Can be stopped during those 10 seconds using SHUTDOWN -a

-----------------------------------------------------------------------

Command Line : SHUTDOWN -s -t 01

Effect : Delayed shutdown

Remarks : Shutdown after a 1 second delay, NO poweroff.

Link to comment
Share on other sites

Windows NT 4 Terminal Server Edition or Windows 2000 (Advanced) Server with Terminal Server installed

Command Line : LOGOFF 16 /SERVER:termserv1

Effect : Logoff

Remarks : Logoff session 16 on Terminal Server TERMSERV1.

Use the QUERY USER command to find out which session ID belongs to whom.

-----------------------------------------------------------------------

Command Line : TSSHUTDN 45 /SERVER:termserv1 /POWERDOWN /DELAY:20 /V

Effect : Delayed poweroff

Remarks :

Notify all users on Terminal Server TERMSERV1, logoff all Terminal Server sessions after 45 seconds, wait another 20 seconds, and then shut down Terminal Server TERMSERV1 and power off.

Link to comment
Share on other sites

Perl (Requires ActivePerl)

Command Line : InitiateSystemShutdown( $sComputer, $sMessage, $uTimeoutSecs, $bForce, $bReboot )

Effect : Comprehensible by looking at the code

-----------------------------------------------------------------------

Command Line : InitiateSystemShutdown( "", "", 0, 1, 1 )

Effect : Reboot

Remarks : Immediate reboot without message, force applications to close without saving data

-----------------------------------------------------------------------

Command Line : InitiateSystemShutdown( "", "Going down...", 10, 0, 1 )

Effect : Delayed reboot

Remarks : Reboot after 10 seconds, with message and without forcing applications to close

-----------------------------------------------------------------------

Command Line : InitiateSystemShutdown( "10.0.1.16", "Sorry", 5, 1, 0 )

Effect : Delayed shutdown

Remarks : Shutdown of remote computer after 5 seconds, with message and forced closing of applications

Link to comment
Share on other sites

Windows Scripting Host (included in Windows 2k/NT/XP, installable on Windows 98/ME)

Command Line :

[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

Effect : Reboot

Remarks :

Requires WMI.

Remove [line numbers].

-----------------------------------------------------------------------

Command Line :

Replace line 4 in the script above with this one:

[4] OpSys.Shutdown()

to shut down the PC instead of rebooting it.

Effect : Shutdown

Remarks : But no poweroff.

-----------------------------------------------------------------------

Command Line :

[1] Const EWX_LOGOFF = 0

[2]

[3] Set wmi = GetObject("winmgmts:{(Shutdown)}")

[4] Set objSet = wmi.InstancesOf("Win32_OperatingSystem")

[5]

[9] For Each obj in objSet

[6] Set os = obj

[7] Exit For

[8] Next

[9]

[10] os.Win32Shutdown EWX_LOGOFF

Effect : Logoff

Remarks :

Requires WMI.

Remove [line numbers].

Link to comment
Share on other sites

Conclusion :

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.

Gibson Research's Wizmo is a collection of tools integrated in a single package.

Among its functions are shutdown, reboot, hibernate and logoff.

And last but not least SysInternals.com's PSSHUTDOWN can perform logoffs, poweroffs, shutdowns and reboots on both local and remote Windows NT 4/2000/XP systems. Absolutely recommended.

:thumbup FLames // Suggestions // Comments Welcome :thumbup

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...