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
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
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:
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)
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 pause
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.
- i want to send a file to a remote server using the scp command
- linux - [hurry] does using the sleep command in cron affect other processing?
- how to modify the program using command line
- Remote development using VSCode and SSH
- Implementation of remote Linux development using vscode
- i want to make a remote control using an infrared led
- linux - regarding remote command execution with ssh
- circle ci - [aws cli] job does not complete when using aws ecs start-task command in circleci
- Python using Matlab command process analysis
- php - using npm command in laravel project gives command not found
- find exact value in csv file using linux command
- command - when submitting with wsl using online-judge-tools, it shows that the browser cannot be found
- [java] restart tomcat using process builder
- excel vba: even if you try to press the command button on the sheet on the remote desktop, the click event does not work in the
- command - i want to rewrite using zenity, but i can't write it well
- php - using docker command in container results in bash: docker-compose: command not found
- i want to write a command to restart ubuntu in docker in a dockerfile
- php - [laravel] command execution using guzzle is not possible
- command - i want to sort files using a batch file
- Automatically modify the bat code of the local IP address
- Bat uses forfiles to automatically delete expired files in batches
- Batch processing perfectly realizes FTP remote backup data
- Batch process to get the number of txt file lines under the folder and add to the file name
- Takeown to get file or folder ownership
- Batch processing to import the file names in File Mania into the corresponding names in the table
- Problems encountered when deleting folders using batch processing
- vbs and bat mixed to modify the volume label of the virtual drive letter
- Guide to using the batch for command
- Bat batch script under Windows using telnet to detect remote ports in batches