Well-known system administrators around the world prefer to use the command line. The psychological reason is to feel superior to the average user, no matter how commonplace. But there is a real need - the command line gives much greater flexibility in managing the system.
It would seem that this statement applies only to Linux systems, where command line management is the most developed and traditional way. But this is a stereotype. After all, NT-based Windows has almost the same administrative tools as Unix, only the commands are called a little differently. For example, if rebooting from the command line on Linux can be done by a simple reboot, then on Windows you need to type commands with parameters.
There is not even one way to βaskβ the system to reboot! The most obvious is the use of shutdown.exe utility. A simple reboot with its help is done like this - shutdown -r -t 0. This means telling the system to reboot immediately. Numerous parameters, the purpose of which can be found out in more detail by running the shutdown command with the "-?" Key, allow the user to display a warning sign. For example, a variation of the shutdown.exe -r -t 60 βc command. A preventive reboot after 60 seconds will display this plate on the screen and create a slight delay of one minute, which will allow the user to save documents. It should be noted that the comment is limited - no more than 127 characters can be specified.
Rebooting from the command line can be started with the "-f" switch, then applications will be terminated by force without warning. Often there is a situation where you are on the go thinking whether to restart the PC. It's not too late - give the shutdown command with the -a switch, which will cancel the reboot.
In addition to the standard utility, which can be rebooted from the command line, there are other ways, some of them are original, but many came from Unix systems. One of these commands is clearly based on Linux systems. See how sophisticated a Windows reboot can be done from the command line: ping -n seconds 127.0.0.1> nul & wmic OS WHERE Primary = "TRUE" CALL Win32Shutdown 6.
Please note that the redirection icon is used, there is still a mention of nul. Naturally, instead of -n seconds, you need to specify the amount through which you plan to restart.
One of the basics of managing the Windows GUI is the rundll32.exe process, which is the host process. With its help dynamic libraries are loaded into memory . This program has a command interface that allows you to operate with graphic elements. Using it, a reboot from the command line can also be performed: undll32 user.exe, ExitWindowsExec 2.
Above is the easiest way to reboot with rundll32, which works on all systems.
You can also use the usual shutdown dialog call: undll32 msgina, ShellShutdownDialog. Or turn off the PC immediately: RUNDLL.EXE user.exe, ExitWindows.
There are teams that work far from all systems, but only on XP up to SP2. In this case, the pipeline element (|) is used, which is typical for systems running Unix: echo y | net stop eventlog.
The command works as follows: a flaw is used to stop the vital service of the event log, which initiates an automatic restart.
But the matter is not limited to these teams. To reboot, you can use scripts on Visual Basic (VBS), utilities of related Microsoft companies. For example, psshutdown from the Ps Tools complex, which is, in fact, an improved shutdown. Type the following command in the console: psshutdown -r -f -t 30. This will restart the local or remote PC within 30 seconds.
Remote rebooting from the command line, say, from a domain controller, is done with the psshutdown -r comp1 command, where comp1 is the name of the PC, they can be listed with a comma. It would be nice to notify users of a reboot. To do this, psshutdown uses the -m switch. The standard command for rebooting remote PCs is tsshutdn.
You may not need all of these methods, but for those who are often confronted with the administration of a Windows-based PC, itβs very useful to know them.