How to reboot windows xp from the command line. Shut down your computer from the command line


Situations may arise in our lives when we urgently need to leave the computer, which cannot be turned off immediately for various reasons. To solve this and similar issues, there is the shutdown command, which allows you to turn off the computer after a scheduled time, reboot it, enter mode, exit our account and much more. In this material, I will talk about shutdown - the command to shut down and restart the Windows OS, describe the features of its keys, and also explain how it is more convenient to use this command when working with your computer.

Most users turn off their computer using start menu, using the menu via Alt+F4, or simply by pressing the PC power button.

An alternative to this could be the shutdown command (translated from English as “shutting down” - shutdown). The functionality of this command allows you to turn off your computer (either immediately or after a while), restart it, enter hibernation mode, and log out of your account. Also, set the shutdown features in a special graphic window, and perform other actions that allow you to customize the process of shutting down the PC to the needs of a specific user.

The command supports both local computer shutdown and remote shutdown, allowing you to shutdown (reboot, hibernate, etc.) other PCs on your network (administrator rights are required).

How to use SHUTDOWN

You can activate shutdown using classic command line, and using the PowerShell toolkit. You can also make working with the command easier by creating a shortcut to launch it on your desktop.

To get started with the command (click the Start button, type cmd in the search bar, and press enter). I recommend running the command line as administrator via video:

The functionality of the shutdown command is as follows:

Of the entire holder of keys, I would note the following:

shutdown /a – the command stops the shutdown or reboot process. Can be useful in a situation where the service Windows updates (Windows Update) decided to restart your computer (or when you or any third party programs started the reboot process);

shutdown /s – command to shut down the PC;

shutdown /r – PC reboot command;

shutdown /g – the functionality of the key is similar to shutdown /r (the computer reboots), and all registered applications are launched again;

shutdown /h – puts the computer into hibernation mode;

shutdown /l – log out of the account current user(log off);

shutdown /p – shuts down the computer without warnings. Equivalent to the command shutdown /s /f /t 0.

SHUTDOWN command - implementation examples

Let's look at popular examples of using the shutdown command:

Example No. 1. Turn off the computer's power immediately

At the command line, type:

shutdown /s /t 0

Type the command with specified keys on the command line

Example No. 2. Turning off the computer's power with a delay

On the command line, use the command:

shutdown /s /t 3600 (3600 is the time in seconds, in in this example this is 60 minutes, i.e. one hour). Instead of 3600, set any time convenient for you, calculating its value in seconds;

Example No. 3. Reboot the computer immediately

shutdown /r /t 0

Example No. 4. Putting the PC into hibernation mode

Enter - shutdown /h/t 0

Example No. 5. Ending the current user's session

Example No. 6. Stopping the computer from shutting down

If you change your mind about turning off the computer, or want to prevent such a shutdown from the system, then type in the command line:

Example No. 7. Reboot the remote computer by IP address

shutdown /r /m\\192.168.0.1

This command allows you to restart the computer with the specified network address, provided you have the appropriate administrative rights.

Example No. 8. Turn off a remote computer using its network name

shutdown /s /t 300 /m \\COMP1

Command turns off power network computer COMP1 in 5 minutes (300 seconds).

Example No. 9. Run the graphical utility showdown

After startup, the “Remote Shutdown Dialog” sign will appear on the screen.

Using the "Add" button you must specify an IP address or name the desired computer, select the desired action, and then fill out the “Note” form (this text will be displayed in a warning about the completion of your planned action).

Example No. 10. Reboot the PC and restore registered applications

Automate the process by creating shortcuts

You can also easily design the command you need as a shortcut located on your desktop. Then, when you need to perform the specified operation, it will be enough to click on the shortcut and the command will be executed.

To perform this operation, do the following:


Conclusion

The shutdown command allows you to perform the necessary operations to shut down and restart your computer. If the functionality of this instrument you are not satisfied, then you can turn to the capabilities of such programs as “Shutdown Timer”, “Time PC”, “Shutdown Scheduler” and other analogues that allow you to turn off the PC at the time you specify.

In contact with

The Windows operating system is the most widespread in the world and it is probably quite difficult to find a user who has never worked in it. However, many people do not know about this OS tool called Shutdown. The command issued with its help allows you to shut down or restart the computer according to a schedule or remotely. How to use this correctly useful tool, we will tell you in this article.

Windows Command Line

The command line interface in the Windows operating system is implemented using two programs. The first is Cmd.exe, present in all versions of the NT family of operating systems, and the second, which first appeared in Windows 7, is more modern and flexible - PowerShell. The peculiarity of their use is direct, without the use GUI, entering text commands.

Modern users, accustomed to working in windowed mode using a mouse, do not pay too much attention to the command line. However, the method may not be very fast, but in some cases it is extremely effective. The toolkit numbers over one and a half hundred useful commands, the capabilities of which can be expanded by using additional keys.

Shutdown command parameters associated with control keys can be viewed by entering in the management console:

shutdown

The output result will contain a complete list of keys for local and networking, as well as a list of digital notification codes transmitted by this command to the user of the remote computer.

Shutdown.exe and windowed mode

To call the graphical interface that Shutdown has, the execution command must be entered with the “/i” switch. Oddly enough, the program running from the command line in this case opens a window familiar to the user. It's called "Remote Shutdown Dialogue".

Use this interface assumed for remote administration computers belonging to the domain. The selection of machines on the network is carried out at the top of the window. You can then set the type of shutdown and the notification that the remote user will receive. In this case, the choice can be made between planned and unscheduled work related to hardware maintenance or software updates.

Network control keys

Let's go back a little and see what capabilities the Shutdown command gets when using keys. Windows 7 and newer versions can work with it both through the old console and through the PowerShell interface. The syntax of the commands in it has remained virtually unchanged, even expanding through the use of new ones, similar to those used in the Linux command line.

So, the control key is entered with a space behind the main text and separated from it by a slash “/”. Below we provide the keys used for remote control computers and deciphering their actions:

/ m\\"computer name"

Accessing a remote machine. Enter or Domain name, or IP address, without quotes.

The field can contain up to 512 characters and is intended to transmit to a remote user comment about the reasons for shutdown or reboot.

/ f

Forced, without warning, termination of all running applications.

/t xxxxxxxxxx

Delay time in seconds before the command is triggered. Allows you to set a time period ranging from zero seconds to one year. In seconds this is 31536000.

/ d [p|u:]xx:yy

Makes it possible to specify the type of event, choosing from three categories - planned, unplanned, expected. Extra options xx and yy contain digital codes reasons from the system events directory.

Canceling a command

Not a single person, not even System Administrator, cannot be one hundred percent immune from errors. And in this case, the question arises: is it possible and how to cancel the Shutdown command issued to remote machine wrong or with the wrong key? Microsoft has provided this possibility.

It is possible to cancel any action, including an incorrectly specified one, but only if, when issuing the command, a delay parameter for its execution was specified. Before the selected period of time has expired, the administrator can reissue the command to the remote computer shutdown/a. In this case, any pre-planned action will be canceled.

This method works for both local and remote computers. On a local machine, having received a warning about an impending action, you will have to issue a command in the console to cancel it. Successful execution will be confirmed by a pop-up message in the notification area.

Local control keys

The capabilities of this command are not limited to working only with remote computers. You can also use Shutdown Windows on your local computer. In this case, the command is specified in text mode through the control console. Keys for control local machine and a description of their actions are given below:

/ l

Ending the session of the current system user.

/ s

Shutdown and shutdown.

/ r

Shutdown and then reboot.

/ g

Shutdown, reboot and restart local computer with all previously opened applications.

/ p

Immediate shutdown without warning.

/ h

Switching the local computer to energy-saving mode.

As you can see, the set of commands for a single computer is also quite large and allows you to shutdown, reboot and put it into sleep mode. In this case, simultaneous use of several keys is allowed.

Task Manager

In addition to working with the command line, it is possible to create a rule using the task scheduler and the Shutdown function. The command, with the necessary keys, in this case is specified in the interface Windows scheduler. This program is located in the “Standard - Utilities” group of the main menu of the operating system. To enter a task, you will need to run it as a system administrator.

Select “Create simple task» and fill in the fields that will open to us as we complete it. At these steps, you will be prompted to name the new scheduled activity and set its schedule. Having reached the step in which we need to specify the program, we will enter our command in the field and specify the necessary arguments. The syntax for entering keys in this case is slightly different. Instead of a slash, they are preceded by a hyphen.

For example, by specifying the -s and -t arguments we get an analogue of shutdown /s /t. A command executed according to the schedule created in this way will lead to the computer shutting down after 30 seconds, during which we will see a warning window.

Finally

Now, if you wish, you can independently create shutdown or maintenance rules for your computer using Shutdown. The team, as you noticed, is very flexible and has enough control keys to satisfy the needs of both simple user, and the network administrator.

Team SHUTDOWN used to end a user session, restart the computer, put it into sleep mode, or turn off the power. If you have the appropriate permissions, the command can be executed on a remote system.

Command line format:

SHUTDOWN.EXE xx:yy ]

If no parameters are specified on the command line, or if the parameter is specified /? - then it appears on the screen brief information on using the command.

Instead of syntax /key allowed to use -key:

SHUTDOWN.EXE [-i | -l | -s | -r | -g | -a | -p | -h | -e] [-f] [-m \\computer][-t xxx][-d xx:yy [-c "comment"]]

Command line options:

/i- Display the graphical user interface. This parameter must come first.
/l- End the session. This option cannot be used with parameters /m or /d.
/s- Shut down the computer.
/r- Shut down and restart the computer.
/g- Shut down and restart the computer. After the system restarts, launch all registered applications.
/a- Cancel system shutdown. This option can only be used during the waiting period.
/p- Immediate shutdown of the local computer without warning. Can be used with parameters /d And /f.
/h- Switching the local computer into hibernation mode. Can be used with parameter /f.
/e- Indicate the reason for the unexpected shutdown of the computer.
/o- Go to the advanced boot options menu and restart the computer. This parameter valid for Windows 8 and above later versions. Must be used with the /r parameter.
/m\\computer- Name or IP address of the destination computer.
/t xxx- Set a delay of xxx seconds before shutting down the computer. Valid range: 0-315360000 (10 years); default value: 30 seconds. If the timeout period is greater than 0, the parameter is applied /f.
/c "comment"- Comment with the reason for restarting or shutting down. The longest length is 512 characters.
/f- Forced closing of running applications without warning users. Parameter /f used if for parameter /t a value greater than 0 is specified.
/d xx:yy You must specify a reason for rebooting or shutting down. "p" means scheduled reboot or shutdown. "u" means the reason is user defined. If neither "p" nor "u" is specified, the reboot or shutdown is unplanned. xx is the primary reason code (a positive integer less than 256). yy is the auxiliary reason code (a positive integer less than 65536).

To manage the shutdown and reboot processes, the user must have administrator rights in relation to the managed system.

Examples of using the SHUTDOWN command:

shutdown or shutdown/?- display help on using the command.

shutdown /s- turn off the computer power after 30 seconds. The user will be notified of the scheduled shutdown.

shutdown /s /t 0- Turn off the computer's power immediately.

shutdown /s /t 60 /m \\COMP7- turn off the power of the COMP7 computer after 60 seconds.

shutdown /s /t 60 /m \\192.168.0.1- turn off the power of the computer with IP address 192.168.0.1 after 60 seconds. If necessary, a user with administrator rights can cancel the shutdown process with the command shutdown -a

shutdown /h- put the computer into hibernation mode. When a command is executed, all information from random access memory(processes, programs, data) are stored in special file hyberfil.sys located in root directory system disk and is executed normal shutdown nutrition. At next switch on computer, dispatcher Windows boot(BOOTMGR) will perform a system state restore from a file hyberfil.sys. Hibernate mode must be enabled for of this computer, for example by the command powercfg /H on or by using the Panel Power Options snap-in Windows management. Also, it is necessary to take into account that in order to implement this mode a large volume will be required free space on the hard drive for a copy of the RAM.

shutdown /l- end the current user's session. The end session command can only be executed on the local computer and only for the current user. Same as running the command logoff without parameters.

shutdown /r- reboot the local computer. By default, reboot will occur after 30 seconds if the option is not specified /t

shutdown /r /o /t 0- reboot the local computer immediately ( t 0, with choice additional options (/o. After the reboot, an action selection menu is displayed on the screen, with which you can either continue the normal boot or select additional modes for diagnostics and system recovery. Parameter /o acceptable for operating rooms Windows systems 8 and later.

shutdown /r /m\\192.168.0.1- reboot the computer with IP address 192.168.0.1.

shutdown /g- reboot and restore execution of applications registered using the API function RegisterApplicationRestart. Typically used when updating the system, when the installation process requires a reboot to continue the installation process.

Reboot the computer with the message "Scheduled reboot" displayed and the reason recorded in the system log - "Scheduled", main code - "12" (0x0B), additional code- "555" (0x022b).

shutdown /i- launching the graphical environment of the utility shutdown.exe. The “Remote Shutdown Dialog” appears on the screen.

To perform a shutdown, reboot, or end user session operation, you must enter a name or IP address computer using the "Add" button, select the desired action, reason and fill in the "Comment" field, the text from which will be displayed in information message about the planned action. For most reasons, the comment field is required, and without filling it out the "OK" button will be inactive.

On Windows 7 and later, remote shutdown or reboot using the command shutdown, may fail with the error “Access denied (5)” even if you have administrator rights and allow remote forced shutdown in local group policies. In addition, when accessing hidden administrative resources C$, ADMIN$... and so on. The remote computer is prompted for a username and password, but the connection is denied access. The problem is solved by removing the computer from home network and adding (changing) a registry parameter to the section:

hklm\Software\Microsoft\Windows\CurrentVersion\Policies\System
need to add parameter LocalAccountTokenFilterPolicy, taking the value dword:00000001

After entering data into the registry, a reboot is required to apply the changes.

In addition:

Power management in Windows command line - command

Shutdown /h puts the computer into hibernation mode.

When a command is executed, all information from RAM (processes, programs, data) is saved in a special file hyberfil.sys, located in the root directory of the system disk and a normal power shutdown is performed. The next time you turn on your computer, Windows Boot Manager will restore the system state from the file hyberfil.sys. The hibernation mode must be enabled for this computer, for example with the command powercfg /h on or using the Windows Control Panel snap-in. Also, it is necessary to take into account that to implement this mode, you will need to have a large amount of free space on your hard drive for a copy of RAM.

Shutdown /s /hybrid /t 0 hybrid shutdown, will be used at next boot fast loading

Parameter /hybrid shuts down the computer and prepares it for quick startup.
Must be used with the /s option

Shutdown /l ends the current user's session. The end session command can only be executed on the local computer and only for the current user. Same as running the command logoff without parameters.

If you want to turn off the computer with a delay, then instead of zeros you need to specify the delay in seconds:

Shutdown /s /t 60

The user will be notified of the scheduled shutdown.

If the delay is very long, such as 60 minutes (3600 seconds), a pop-up message appears in the lower right corner of the screen instead of a warning window.

While the delay is in effect, you can stop the computer from shutting down. To do this, enter the command on the command line:

Shutdown/a

Once the shutdown is cancelled, a pop-up message will appear in the lower right corner of the screen.

Shutdown /r /m \\192.168.0.10 reboot the computer with the IP address 192.168.0.10

Shutdown /s /t 60 /m \\COMP1 turn off the power to computer COMP1 after 60 seconds

shutdown /s /t 60 /m \\192.168.0.10 turn off the power of the computer with the IP address 192.168.0.10 through 60 seconds.

Shutdown /g reboot and restore execution of applications registered using the function API RegisterApplicationRestart. Typically used when updating the system, when the installation process requires a reboot to continue the installation process.

Shutdown /i launch the graphical utility environment shutdown.exe. Displayed on screen

In the window Remote shutdown dialog To perform the operation of shutting down, rebooting or terminating a user session, you need to enter the name or IP address of the computer using the button Add, select the desired action, reason and fill in the field Note, the text from which will be displayed in the information message about the planned action. For most reasons, the field Note is required, and if it is not filled in, then the button OK will be inactive.

If no parameters are specified on the command line, or the /? parameter is specified. - then brief information on using the command is displayed on the screen.

Instead of syntax /key is allowed use -key
Team shutdown can accept following parameters:
/i Display the graphical user interface.
This parameter must come first.
/l End the session. This option cannot be used with
parameters /m or /d.
/s Shut down your computer.
/r Shut down completely and restart the computer.
/g Shut down completely and restart the computer. Running all
registered applications after a system reboot.
/a Cancel system shutdown.
This option can only be used during the waiting period.
/p Shuts down the local computer without delay or warning.
Can be used with parameters /d And /f.
/h Putting the local computer into hibernation mode.
Can be used with parameter /f.
/hybrid Shuts down the computer and prepares it for quick startup.
Must be used with parameter /s.
/e Specify the reason why your computer shuts down unexpectedly.
/o Go to the advanced boot options menu and restart the computer.
Must be used with parameter /r.
/m\\computer Specifying the destination computer.
/t xxx Specifying a wait time of xxx seconds before the computer shuts down.
Acceptable range: 0-315360000 (10 years); default value: 30.
If the delay is greater than 0, the use of the parameter is implied /f.
/c "comment"

Many users operating systems Windows is not aware that you can restart your computer directly from the command line Windows strings. This method is convenient when you are connected to to a remote computer(remote reboot), or if you need to create a restart script and run it on a schedule through the scheduler.

So - how to restart your computer via the command line?
To reboot in Windows there is a special console command shutdown.
The command syntax is as follows:

C:\Users\>shutdown -? Usage: shutdown xx:yy ] Additional parameters (switches): /? - Display help. Same as without parameters. /i - Display the graphical user interface. This parameter must come first. /l - End the session. This option cannot be used with the /m or /d options. /s - Shut down the computer. /r - Shut down and restart the computer. /g - Shut down and restart the computer. After the system restarts, launch all registered applications. /a - Cancel system shutdown. This option can only be used during the waiting period. /p - Immediately shutdown the local computer without warning. Can be used with the /d and /f options. /h - Switches the local computer to hibernation mode. Can be used with the /f option. /e Specifies the reason why the computer shut down unexpectedly. /m \\computer - Specifies the destination computer. /t xxx - Set a delay of xxx seconds before shutting down the computer. Valid range: 0-315360000 (10 years); default value: 30. If the timeout period is greater than 0, the /f option is applied. /c "comment" - Comment with the reason for restarting or shutting down. The longest length is 512 characters. /f - Forces closure of running applications without warning users. The /f option is used if the /t option is set to a value greater than 0. /d xx:yy - You must specify a reason for the reboot or shutdown. "p" means scheduled reboot or shutdown. "u" means the reason is user defined. If neither "p" nor "u" is specified, the reboot or shutdown is unplanned. xx - is the main reason number (a positive integer less than 256). yy is the auxiliary reason number (a positive integer less than 65536).

Examples of using:
Shutting down the computer via the command line:

Same with forced termination applications:

The same with the message in the window:
shutdown -r -t 60 -s “Restart in a minute”
Cancel delayed Windows reboot:
shutdown -a

If necessary, commands can be placed in a BAT file and used as a script!







2024 gtavrl.ru.