How to turn off the computer through the command line: automatic shutdown. How to turn off the computer after a certain time

Team SHUTDOWN used to end a user session, restart the computer, put it to sleep, or turn off the power. With the appropriate permissions, the command can be executed against a remote system.

Command line format:

SHUTDOWN.EXE xx:yy ]

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

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- Displaying a graphical user interface. This parameter must be the first.
/l- Ending a session. This option cannot be used with options /m or /d.
/s- Shut down the computer.
/r- Shut down and restart your computer.
/g- Shut down and restart your computer. After restarting the system, 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 to hibernation mode. Can be used with parameter /f.
/e- Specify the reason for the unexpected shutdown of the computer.
/o- Go to the advanced boot options menu and restart your computer. This setting is valid for Windows 8 and later. Must be used with the /r option.
/m \\computer- Name or IP address of the target computer.
/txxx- 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 reason for restart or shutdown. The maximum length is 512 characters.
/f- Forced closing of running applications without warning users. Parameter /f is used if the parameter /t set to a value greater than 0.
/dxx:yy You must provide a reason for rebooting or shutting down. "p" means scheduled reboot or shutdown. "u" means that the reason is user defined. If neither "p" nor "u" is specified, a reboot or shutdown is unscheduled. xx is the main reason code (positive integer less than 256). yy is a minor reason code (positive integer less than 65536).

To control the shutdown and reboot processes, the user must have administrative rights to the managed system.

Examples of using the SHUTDOWN command:

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

shutdown /s- power off the computer after 30 seconds. The user will be warned about the planned shutdown.

shutdown /s /t0- turn off the power of the computer 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 the 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 RAM (processes, programs, data) is stored in a special file hiberfil.sys located in the root directory of the system drive and a normal power off is performed. The next time you turn on your computer, Windows Boot Manager (BOOTMGR) will restore the system state from the file hiberfil.sys. The hibernation mode must be enabled for this computer, for example, by command powercfg /H on or by using the Power Options snap-in in the Windows Control Panel. Also, it must be taken into account that the implementation of this mode will require a large amount of free space on the hard disk for a copy of the RAM.

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

shutdown /r- restart the local computer. By default, the reboot will take 30 seconds if no parameter is set. /t

shutdown /r /o /t0- restart the local computer immediately ( t0, with a choice of additional options ( /o. After the reboot, a menu for selecting actions is displayed on the screen, with the help of which you can either continue the normal boot, or select additional modes for diagnosing and restoring the system. Parameter /o Valid for Windows 8 and later operating systems.

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

shutdown /g- perform a reboot with the restoration of the execution of applications registered using the API function RegisterApplicationRestart. Usually used during system upgrades, when a reboot is required during the installation process to continue the installation process.

Reboot the computer, displaying the message "Planned restart" and recording the reason in the system log - "Planned", the main code is "12" (0x0B), the additional code is "555" (0x022b).

shutdown /i- launching the graphical environment of the utility shutdown.exe. The "Remote Shutdown Dialog" is displayed on the screen.

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

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

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

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

In addition:

Windows command line power management - command

There are situations when we need to leave our computer on for a long time. This may be due to the operation of the PC at night, when any large files are downloaded, or when operating system updates are installed for a long time - the fact is that it becomes necessary to automatically turn off the computer without the direct participation of the user. In this article, I will tell you how to turn off the computer after a certain time, and also introduce the reader to tools that can help us in the planned shutdown of our PC by timer.

Turn off the computer automatically at a specified time

How to turn off the computer after a certain time using the Windows toolkit

If you need to turn off the computer on a timer, then the simplest and most convenient solution would be to use the tools built into the Windows OS. The special shutdown command, as well as the task scheduler built into the system, will serve as such tools.

How to use the shutdown command

To use this command, press the key combination Win + R, and in the line that appears, enter (instructions for opening the command line in and):

shutdown -s -t 3600 /f

  • s - completion of work;
  • t - indicates the time in seconds after which our PC will be turned off. That is, 3600 is 60 minutes (1 hour). Instead of this number, you can enter your own, having previously calculated how much time you need will take in seconds;
  • f - from English. "forced" - forcibly. Instructs the system to force quit all active applications, that is, no program can prevent you from shutting down your PC.

After you click on "OK", you will receive a system notification that your computer will turn off after a specified time. If you suddenly change your mind, then press Win + R again and type in the line that appears:

shutdown -a

and this feature will be disabled.

How to use Task Scheduler

Using this scheduler, you no longer need to think about how to turn off the computer after a certain time, the program will do everything for you thanks to the schedule you created. At the same time, please note that this feature exists in the Windows OS family starting from version 7.

So, do the following:

  • Click on the "Start" button;
  • In the search bar, enter taskschd.msc and click on "OK". A task scheduler window will open in front of you;
  • Click on "Action" on the top left;
  • Select the Create Basic Task option;
  • In the window that appears, enter the appropriate name, for example, "Automatic shutdown of Windows" and click on "Next" at the bottom;
  • Next, you will need to select the shutdown frequency. If you want to do this every day, for example, at 3 am, then select "Daily", otherwise select another option and click on "Next";
  • In the next window, determine the shutdown time and click on "Next";
  • In the "Action" option, select "Run a program" and click "Next" again
  • In the line under the inscription "Program and script" we write:

C:\Windows\System32\shutdown.exe

In the argument field, type:

How to use bat file to shutdown PC automatically at specified time

An effective answer to the question of how to turn off the PC after a certain time can be the use of a bat file. When you click on such a file, your computer will shut down after the desired time.

Open notepad and type in:

@echo off

if %time%==01:00:00.00 goto:b

goto:a

shutdown.exe /s /f /t 60 /c "Goodnight, your computer is shutting down"

  • Save this file as shutdown.bat (make sure it is shutdown.bat and not shutdown.bat.txt) on your desktop.
  • If necessary, activate it by clicking on it.
  • You will see a blank command prompt screen, then just minimize it and go about your business.
  • At the right time (in this text it is one in the morning) you will see a message about turning off the computer and your PC will turn off.
  • You can change the shutdown time by entering other numbers instead of "01:00:00.00".

We turn off the computer at a certain time using programs

In the question of how to turn off the system after 10 minutes or after an hour, third-party software applications that need to be installed on your computer can also help. These are such products as PC Auto Shutdown, Wise Auto Shutdown Software and a number of others.

PC Auto Shutdown - turn off the PC on a timer

This PC Auto Shutdown application for Windows will allow you to shut down your computer after the desired time. To use its functionality, do the following:


Wise Auto Shutdown - turn off the computer at a specified time

Another application with functionality that will help you with the answer to the question "how to turn off the computer after a while." Wise Auto Shutdown allows you to set a schedule to shut down, restart, log out of your account and sleep your PC for the desired time and date, you can also set up the regular execution of these actions. 5 minutes before the action, the system will notify you of the planned outage.

In the working window, select a task, its regularity (daily - daily, from now - starting from now, on idle - when the system is idle) or one-time activation exactly at a certain time (specified time).

Other applications for deactivating a computer at a specific time

With a solution to the problem of turning off the computer after the right time, in addition to the above applications, others can help. I would mention such products as Aquarius Soft, Winmend Auto Shut Down, Fastimizer, Free Auto Shutdown, PCmate Free Auto Shutdown, Timed Shutdown and a number of others. All of them have similar functionality, allowing you to set the time and frequency of turning off your PC.

Conclusion

In the task of how to turn off the computer after a certain time, the user can be helped by both regular Windows OS tools and a variety of software products that need to be downloaded and installed on your PC. In most cases, the Windows toolkit is enough, which allows you to easily and quickly turn off the computer at the right time for the user.

Turning off the computer is a fairly typical procedure that rarely causes any difficulties for anyone. However, if you need to turn off the computer not right now, but after some time, then everything is a little more complicated. Now we will talk about how to turn off the computer after a certain time.

Turn off the computer after a certain time using the command line

The easiest option is to use the shutdown command. This command can be entered in, but the easiest way is to open the Run window (using the Windows-R key combination) and enter commands into it.

The shutdown command has many options. If you want to see them all, then run the "shutdown /?" command. We will consider only a few of the most important of them:

  • /s - shutdown:
  • /h - hibernate:
  • /f - forced closing of all open programs without warning the user;
  • /t - setting the timer in seconds;

So, in order to turn off the computer after a certain time, we need to execute the shutdown command with the parameters / s (shutdown the computer) and / t (set the timer). Thus, the final command to turn off the computer will look something like this:

  • shutdown /s /t 60

After executing this command, the computer will turn off after 60 seconds. Naturally, you can specify not 60 seconds, but any other time you need (in seconds). If necessary, you can use the shutdown command to restart the computer or put it into hibernation. To do this, change the /s option to /r (reboot) or /h (hibernate).

Turn off the computer after a certain time using the scheduler

Another option is to use the Task Scheduler. To start the Task Scheduler, open the Start menu and type "Task Scheduler" into the search box. You can also start the Task Scheduler by running the taskschd.msc command.

After starting the Task Scheduler, you need to create a new task and set it to turn off the computer after a certain time. To do this, click on the "Create a simple task" button.

After that, you will see a window for creating tasks. At the first stage, you just need to enter the task name and click on the "Next" button.

Next, you need to select the response frequency for our task. If you want to turn off the computer only once, then select "Once". If necessary, you can select the option "Daily" or any other.

The next step is to select the action that will be performed when the task is triggered. Here you need to select the option "Run the program".

After that, you need to enter the shutdown command and parameters for it. For example, let's enter the parameter / s (shutdown the computer) and the parameter / t (timer for 60 seconds).

This completes the creation of the task, at the last stage, simply click on the "Finish" button.

After that, the task you created will appear in the Scheduler Library.

Turn off the computer after a certain time using programs

You can also use specialized programs to turn off the computer after a certain time. For example, we will consider two popular programs of this kind.

Airytec Switch Off is a small system program that allows you to automatically turn off your computer at a certain time. This program has a small number of functions and a fairly simple interface. Thanks to this, anyone can cope with it. It should also be noted that this program has a web interface. This allows you to turn off your computer over a local network or even over the Internet.

Powerful computer shutdown program. This program has many settings, which allows you to adjust it to any task. Among the shortcomings of this program, one can single out perhaps a too confusing interface that can scare off inexperienced users.

There are situations when we need to leave our computer on for a long time. This may be due to the operation of the PC at night, when any large files are downloaded, or when the operating system updates are installed for a long time - the fact is that it becomes necessary to automatically turn off the computer without the direct participation of the user. In this article, I will tell you how to turn off the computer after a certain time, and also introduce the reader to tools that can help us in the planned shutdown of our PC by timer.

Turn off the computer automatically at a specified time

How to turn off the computer after a certain time using the Windows toolkit

If you need to turn off the computer on a timer, then the simplest and most convenient solution would be to use the tools built into the Windows OS. A special team will serve as such tools for us. shutdown, as well as a built-in task scheduler.

How to use the shutdown command

To use this command, press the key combination Win + R, and in the line that appears, enter:

shutdown -s -t 3600 /f

  • s- completion of work;
  • t- indicates the time in seconds after which our PC will be turned off. That is, 3600 is 60 minutes (1 hour). Instead of this number, you can enter your own, having previously calculated how much time you need will take in seconds;
  • f- from English. "forced" - forcibly. Instructs the system to force quit all active applications, that is, no program can prevent you from shutting down your PC.

After you click on "OK", you will receive a system notification that your computer will turn off after a specified time. If you suddenly change your mind, then press Win + R again and type in the line that appears:

and this feature will be disabled.

How to use Task Scheduler

Using this scheduler, you no longer need to think about how to turn off the computer after a certain time, the program will do everything for you thanks to the schedule you created. At the same time, please note that this feature exists in the Windows OS family starting from version 7.

So, do the following:

  • Click on the "Start" button;
  • In the search bar, enter taskschd.msc and click on "OK". A task scheduler window will open in front of you;
  • Click on "Action" on the top left;
  • Select the Create Basic Task option;
  • In the window that appears, enter the appropriate name, for example, "Automatic shutdown of Windows" and click on "Next" at the bottom;
  • Next, you will need to select the shutdown frequency. If you want to do this every day, for example, at 3 am, then select "Daily", otherwise select another option and click on "Next";
  • In the next window, determine the shutdown time and click on "Next";
  • In the "Action" option, select "Run a program" and click "Next" again
  • In the line under the inscription "Program and script" we write:

C:\Windows\System32\shutdown.exe

In the argument field, type:

How to use bat file to shutdown PC automatically at specified time

An effective answer to the question of how to turn off the PC after a certain time can be the use of a bat file. When you click on such a file, your computer will shut down after the desired time.

Open notepad and type in:

if %time%==01:00:00.00 goto:b

shutdown.exe /s /f /t 60 /c "Goodnight, your computer is shutting down"

  • Save this file as shutdown.bat (make sure it is shutdown.bat and not shutdown.bat.txt) on your desktop.
  • If necessary, activate it by clicking on it.
  • You will see a blank command prompt screen, then just minimize it and go about your business.
  • At the right time (in this text it is one in the morning) you will see a message about turning off the computer and your PC will turn off.
  • You can change the shutdown time by entering other numbers instead of "01:00:00.00".

We turn off the computer at a certain time using programs

In the question of how to turn off the system after 10 minutes or after an hour, third-party software applications that need to be installed on your computer can also help. These are such products as PC Auto Shutdown, Wise Auto Shutdown Software and a number of others.

PC Auto Shutdown - turn off the PC on a timer

This PC Auto Shutdown application for Windows will allow you to shut down your computer after the desired time. To use its functionality, do the following.


It is not uncommon that situations arise when we need to turn off the computer through the command line.

For example, right in front of your eyes, the virus “eats” files and the best way out in this situation is to disable
PC urgently.

The special Windows command " shutdown". How to use it and other commands, we will consider below.

1. Shutdown on the command line

With the help of shutdown, you can not only turn off the computer quickly, but also restart it, or set the time after which it should turn off.
The team also does an excellent job of “forced” shutting down the PC, in the event that something prevents the computer from shutting down.

2. Command line. Launch.

In order to start using the shutdown command to turn off the PC, you need to open the command line itself.
In the "Start" menu, we enter the "All Programs" section, then "Accessories" and find "Command Prompt" there.
The second, easier method is the keyboard shortcut Windows+R.

3. Input instructions

Everything is quite simple. Enter shutdown in the required field, and then press the space and dash and use one letter that leads to a different result.
shutdown -s - shutdown the computer; shutdown -r - restart the computer; shutdown -a - stop turning off the computer; shutdown -f - shut down the computer forcibly.

4. Other instructions.

In addition to the shutdown command, there is a set of other instructions. They look like this:
- i - displays help about a set of commands;
- l - exit the menu;
- m – interaction with a remote PC;
- t [time after which the PC must be turned off];
- d - the reason for turning off the PC.

5. Alternative option for entering commands

All the commands listed above can also be entered in the program "execution" window.
Press keyboard shortcut Win+R and open access to the utility " Run". To force shutdown the PC, just enter the following into it:


More complex commands, examples of which you saw above, can also be entered here.
This method has some advantages. For example, after entering a command after a certain period of time, the user will be broadcast the time after which the machine will be turned off.
That is, if you set the shutdown timer to 60 seconds, then a small window will appear on the screen in which the seconds will decrease to zero. As soon as the timer ticks to "zero", the PC will turn off.
CATEGORIES

POPULAR ARTICLES

2022 "mobi-up.ru" - Garden plants. Interesting about flowers. Perennial flowers and shrubs