When making a remote connection,Often shut down remotely,Remote restart.When performing remote server maintenance,Often, basic computer operations such as remote shutdown and restart are required.Use the shutdown forced shutdown restart command and the shutdown restart command in the start menu,Basically can guarantee that the remote computer restarts quickly,Rarely have problems.

The syntax of the shutdown command under windows is:

Usage:shutdown [/i |/l |/s |/r |/g |/a |/p |/h |/e] [/f] [/m \\ computer] [/t xxx] [/d [p | u:] xx:yy [/c "comment"]]

The meaning of each parameter is

/#63;Show help.This is the same as not typing any options.

/i Displays the graphical user interface (gui).

This must be the first option.

/l Log out. This cannot be used with the/m or/d options.

/s Shuts down the computer.

/r Shuts down and restarts the computer.

/g Shuts down and restarts the computer.After the system restarts,

Restart all registered applications.

/a Aborts system shutdown.

This can only be used during timeouts.

/p shuts down the local computer,No timeouts or warnings.

Can be used with the/d and/f options.

/h Hibernates the local computer.

Can be used with the/f option.

/e Records why the computer shut down unexpectedly.

/m \\ computer Specifies the target computer.

/t xxx Sets the timeout before shutdown to xxx seconds.

The valid range is 0-315360000 (10 years) and the default value is 30.

/F is implied if the timeout is greater than 0


/c "comment" Comment on the reason for the restart or shutdown.

A maximum of 512 characters is allowed.

/f forces running applications to close,Don't warn users in the foreground.

When a value greater than 0 is specified for the/t parameter,

The/f parameter is implied.

/d [p | u:] xx:yy Provides the reason for the restart or shutdown.

p indicates that a restart or shutdown is planned.

u indicates that the cause is defined by the user.

If neither p nor u are specified,Unplanned restart

Or off.

xx is the major number (a positive integer less than 256).

yy is the minor reason number (a positive integer less than 65536).

Use as follows

1.shutdown/r/f/t 0

2.Start menu-shut down the computer-restart

Two commands run at the same time,Of course, it is better to stop some important services before,Such as databases to prevent data loss.There will be a delay after the first shutdown command is executed.Can guarantee to click off the program that has not exited,If you simply use the restart command in the start menu for remote restart,The probability that the server cannot be shut down properly is quite large.It can be said to be very unreliable,Instead, the shutdown command is more reliable,But for completeness,I use both commands at the same time,Although it is more troublesome, it is more convenient than going to the computer room staff for assistance.After all, the server does not restart often.

Examples of using the shutdown command:

1.shutdown/r/f/t 0

This command asks the computer to force close any application immediately,And restart your computer.If restart is not required,You only need to change/r to/s. If you need to delay for a period of time, you only need to add/t xxx, plus the time delay is equivalent to the preset commandUseful when some tasks of the system have not finished running,Such as the download is complete,Program running and so on.

2. Shut down the remote computer

Use the parameter -m [\ computername] to specify the name of the remote computer that will be shut down or restarted (if not set or empty, it will operate on this machine by default)

shutdown/s/m/remotewin/t 45

The above command is to shut down the computer named remotewin in the LAN within 45 seconds.If the prompt "access is denided" is returned, you do not have permission to shut down the remote computer.Need to set windows security policy or be authorized to shut down the computer remotely.

3. Execute shutdown command with dialog interface

Just add a "/i" parameter to the above shutdown command

4. Cancel the shutdown command

After executing the above shutdown command,If you regret and want to cancel the shutdown immediately,Please immediately enter the command:shutdown/a to immediately cancel the above shutdown operations,Of course, the shutdown time set by the shutdown command has not yet arrived.If the computer enters the shutdown state or the original shutdown command is to shut down immediately, it will not be able to return to the sky,Canceling the shutdown is not effective.

For your convenience, you can save the command as a bat file for easy enforcement.

@echo off
rem restart
shutdown/r/f/t 0

If i want to restart,Just double-click directly.


1. After we set restart,You can summarize the actual restart time of your remote computer yourself,Until you can log in remotely,Important for maintaining server time urgency,Usually 3-4 minutes, this time will be subject to "self-test", "starting running software such as ghost, etc.", "startup menu delay waiting,Such as the "double-start system or the default wait time for one-click restore" and other effects, if you exceed your own time limit,Such as half an hour,Then the computer is too a little boring.Can only seek assistance from the computer room staff to smooth it out.

2, shutdown remote shutdown requires permissions,Open the "Computer Configuration-Windows Settings-Security Settings-Local Policies-User Rights Assignment" in the gpedit.msc Group Policy Editor, and select "Force shutdown from remote system" in the right window to set or assign permissions.