• Command to disable a program on a computer. How to turn off your computer after a certain time

    Turning off a computer using a timer is a very typical task that many users face. However, not everyone knows how this problem can be solved. In this article we will talk about how to turn off your computer using a timer in Windows 7, 8, 10 and XP. To solve this problem we will use the command line, task scheduler and third-party programs.

    Turn off the computer using a timer using the command line

    The simplest and quick way To turn off the computer using a timer is to use the “shutdown” command, which works equally well in Windows 7 and in others Windows versions. This command can be executed from the command line or using the Run menu.

    The shutdown command has many parameters that allow you to fine-tune the process of shutting down your computer. Below we will look at the most basic of them:

    • /s – Shut down the computer;
    • /h – Switch to hibernation mode;
    • /f – Force termination of all open source software without warning the user;
    • /t – Set the timer in seconds.

    To turn off the computer using a timer using shutdown commands, we need to use the parameters /s (shut down the computer) and /t (set a timer). Thus, the command to turn off the computer will look like this:

    • Shutdown /s /t 60

    After executing such a command through the Command Prompt or Run menu, the computer will shut down after 60 seconds.

    If you want to reboot the computer using a timer, then instead of the /s parameter, you need to use the /r parameter. The same thing with hibernation mode. We use /h instead of /s and the computer, instead of turning on, will go into hibernation mode. You can also add the /f option. In this case, shutdown (reboot, hibernation) will begin immediately, and all running programs will be closed without warning the user.

    The disadvantage of this method of shutting down the computer is that the shutdown task is created only for one time. If you need to turn off your computer on a timer daily, then you need to use Task Scheduler or third-party programs.

    We use the scheduler to turn off the computer using a timer

    Very accessible on Windows 7, 8, 10 and XP operating systems powerful tool called "Task Scheduler". You can use it to turn off your computer using a timer. To open Task Scheduler, launch the Start menu (or Start screen with tiles if you're using Windows 8) and search for "Task Scheduler." You can also start the Task Scheduler using the “taskschd.msc” command.

    After starting the task scheduler, click on the “Create a simple task” button. This button is on the right side of the window.

    Then we are asked to indicate when we want to complete this task. You can select "Once" if you want to timer off your computer only once. If you need to turn off your computer using a timer daily or in another mode, then you can choose another option that is more suitable for you.

    On next stage you need to specify the triggering of this task.

    After this, we need to enter the shutdown command as well as startup parameters. How the launch parameters of this command are used has already been discussed above.

    That's it, the task to turn off the computer using a timer has been created. You can view it in the Assignment Library.

    From context menu(right click with the mouse) you can manage the created task.

    You can run, complete, disable, delete, or open the job properties.

    Programs for turning off the computer using a timer

    If the described methods for turning off a computer using a timer do not suit you or seem too complicated, then you can turn off the computer using programs from third-party developers. Below we will look at several such programs.

    Powerful free program to turn off the computer using a timer. Using the PowerOff program you can configure almost any little thing. On the other hand, due to the huge number of functions, the interface of this program is too overloaded. Which can be very difficult to figure out.

    A small program to turn off your computer. The Switch Off program is equipped with a small number of functions and has an easy and intuitive interface. The program is equipped with a built-in web server that allows you to turn off your computer by local network or via the Internet.

    The developer of this program for turning off the computer using a timer claims to support only Windows 7, 8 and XP. Although it should work on Windows 10 without problems.


    Situations often arise when we need to shut down the computer via the command line.

    For example, right before your eyes, a virus “eats” files and the best way out in the given situation it is precisely the shutdown
    PC urgently.

    Best fit special Windows team " Shutdown" We will look at how to use it and other commands below.

    1. Shutdown command line

    Using shutdown, you can not only quickly turn off your computer, but also reboot it, or set it a time after which it should turn off.
    The team also does an excellent job of “forcefully” shutting down the PC if something prevents the computer from shutting down.

    2. Command line. Launch.

    In order to start using the shutdown command to shut down your PC, you need to open the command line itself.
    In the “Start” menu, go to the “All Programs” section, then “Accessories” and find “Command Prompt” there.
    The second, simpler method is a keyboard shortcut Windows + R.

    3. Input instructions

    It's quite simple. Enter shutdown in the required field, and then click on the space and dash and use one letter that leads to different results.
    shutdown –s – shutdown the computer; shutdown –r – reboot the computer; shutdown –a – stop shutting down the computer; shutdown –f – forcefully shut down the computer.

    4. Other instructions.

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

    5. Alternative option entering commands

    All the commands listed above can also be entered into the program “execute” window.
    Press the keyboard shortcut Win+R and open access to the utility " Execute" To force shutdown your PC, just enter the following:


    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, 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.

    Graphic Windows interface Over the years, knowledge of the command line has faded. But no, no, you have to use it. In this article I will briefly describe how to use the console command shutdown to shut down or reboot your computer Windows control. The article is relevant for Windows family 7/8/8.1/10.

    The shutdown command to shutdown, reboot, or hibernate

    To shutdown, reboot, or hibernate using the command line, use the shutdown command. Main list of parameters:

    • /? — 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.
    • /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 local computer without warning. Can be used with the /d and /f options.
    • /h - Switches the local computer into hibernation mode. Can be used with the /f option.
    • /e - Indicates the reason for the unexpected shutdown of the computer.
    • /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” A comment with the reason for restarting or shutting down. The longest length is 512 characters.
    • /f - Forced close running applications without warning users. The /f option is used when the /t option is set to a value greater than 0.
    • /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 number (a positive integer less than 256). "yy" is the reason auxiliary number (a positive integer less than 65536).

    If you are interested full list parameters then run the utility shutdown without parameters.

    Examples of using the shutdown utility

    If you run the utility shutdown with parameter /i, then on the screen you will see something like the following (relevant for Windows 7):

    When using delayed reboot:

    Shutdown /r /t 180

    We will receive the following notification on the screen:

    If you want to cancel the scheduled reboot, use the command:

    Shutdown

    You should see something like this in the notification area near the clock.

    Command Line Utility shutdown is a built-in Windows command that allows you to restart, shut down, hibernate, or end the user's session. In this manual, we will show basic examples of using the shutdown command in Windows (all discussed commands are launched in the Run window - Win + R ->, in the cmd.exe command line or in the PowerShell console).

    The shutdown command has the following syntax:

    shutdown xx:yy ]

    As you can see, the command has quite a few options and also has the ability to perform shutdown/reboot operations on remote computer.

    Shutdown Windows using the Shutdown command

    To shut down Windows OS and the computer, you must use the shutdown command with the key /s.

    Reboot Windows

    To restart your computer, you need to add the option /r. After completing this Windows commands will reboot correctly.

    Ending a user session

    To end the current user session (logout), you need to run the command:

    This command is similar to running the command logoff.

    Putting your computer into hibernation mode

    To put the computer into hibernation mode (in this mode, all memory contents are written to a file hyberfil.sys to the disk and the computer goes into sleep mode with reduced power consumption), run the command:

    Restarting the computer with a message to users

    You can warn all Windows users about the upcoming shutdown/reboot of the computer or server by sending a message to all active sessions (usually this feature is used on RDS terminal servers, where several users work simultaneously, each in their own RDP session).

    shutdown /r /c “This server will reboot in 60 seconds.”

    Delayed shutdown/reboot of the computer

    You can turn off or restart your computer with a certain delay (by a timer). Using the option /t you can specify the time interval (in seconds) after which the PC/server will be rebooted or shut down. This way, you can give users extra time to save time. open files and close applications correctly. This option is convenient to use in conjunction with sending a message. In this example, we specify that Windows will shut down in 10 minutes (600 seconds) and inform users with a message.

    shutdown /s /t 600 /c "The server will be shut down in 10 minutes. Save your documents!"

    The user will receive a warning about the scheduled shutdown: Your session will end.

    If the delay is very long, for example 100 minutes (6000 seconds), then instead of a warning window, a pop-up message appears in the lower right corner of the screen: “ Your session will be ended. Windows will shut down in 100 minutes».

    Cancel shutdown/restart of computer

    After running the shutdown command or reboot Windows, by default the shutdown utility waits 60 seconds without performing any action. The administrator can cancel the reboot or shutdown of the device if during this time he manages to execute the command:

    After canceling the shutdown, a pop-up message will appear in the lower right corner of the screen: “ Logout cancelled. Scheduled shutdown canceled».

    Restart your computer immediately

    To shut down or restart your computer immediately, without waiting the standard 60 seconds, you must specify a value of 0 for the /t parameter. For example, to immediately restart the computer:

    shutdown /r /t 0

    A very important key /f. I use it almost always when shutting down or rebooting Windows servers. This attribute ensures forced termination of all running programs and processes, without waiting for confirmation from the user (we won’t wait for confirmation of closing programs from all users on the terminal server, we simply won’t wait for it).

    The following command will reboot your computer from automatic start all registered applications after reboot (meaning applications registered in the system using API functions RegisterApplicationRestart).

    Running the shutdown command on remote computers

    You can reboot a remote computer over the network; to do this, you must have access to it. network access, A account, from which the shutdown command is launched must be part of the group local administrators on a remote computer (server):

    shutdown /r /t 120 /m \\192.168.1.100

    If all of the above conditions are true, but when you run the shutdown command, you receive an "Access Denied (5)" error, you need to (C$, ADMIN$) on the remote computer by changing the value of the LocalAccountTokenFilterPolicy parameter to 1.

    reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "LocalAccountTokenFilterPolicy" /t REG_DWORD /d 1 /f

    If you need to remotely reboot many computers, you can save a list of them in text file and start a remote reboot of all computers using the following PowerShell script:

    $sh_msg = "Your computer will automatically restart in 10 minutes. Save your files and close any running programs"
    $sh_delay = 600 # seconds
    $computers = gc C:\PS\PC-list.txt
    foreach ($comp in $computers)
    {
    & "C:\Windows\System32\SHUTDOWN.exe" "-m \\$comp -r -c $sh_msg -t $sh_delay"
    }

    shutdown command graphical interface

    For those who are not comfortable working on the command line, there is GUI for the shutdown command, to call it, type:

    As you can see, in the remote shutdown dialog you can add several computers that need to be restarted/shut down, specify the notification text and set the shutdown reason to be saved in the Windows log.

    Shortcut to restart your computer

    For the convenience of users, you can create shortcuts on the desktop to shut down or restart the computer from the necessary settings. Such a shortcut can be useful for rebooting from an RDP session when there are no reboot/shutdown buttons in the Start menu.

    If you want your computer or server to always shutdown/reboot at certain time you can add the shutdown command with certain parameters to the scheduler Windows jobs taskschd.msc.

    For example, the following scheduler task will reboot the computer every night at 0:00 at night.

    $Trigger= New-ScheduledTaskTrigger -At 00:00am -Daily
    $User= "NT AUTHORITY\SYSTEM"
    $Action= New-ScheduledTaskAction -Execute "shutdown.exe" -Argument "–f –r –t 120"
    Register-ScheduledTask -TaskName "RebootEvertyNight_PS" -Trigger $Trigger -User $User -Action $Action -RunLevel Highest –Force

    Automating certain processes on a computer can often significantly increase the usability of a PC not only at work, but also in everyday life. In one of the topics, for example, we looked at ways to add any program to your computer's startup: .

    This article will be devoted to such a moment as automatic shutdown of the computer after a specified period of time. We will carry out all manipulations exclusively using our own Windows systems, without use third party programs . In addition, we will not limit ourselves to executing bare commands, but will add a little usability to the entire process.

    How to perform shutdown to shut down and restart your computer

    Let's not jump right off the bat, let's start from the very beginning. And the beginning is the main thing command to turn off computer, which we will use. In Windows OS, to shut down the work, just send the command to the system shutdown with the required parameters.

    Basically, the team shutdown can be done in different ways:


    All three methods are similar and support the same parameters, so we will not focus on this and will perform the entire process in the console, that is, in the Windows command line.

    How does it work? To make the computer turn off automatically, that is, without having to go to the Start menu and click the Shutdown button there, we need to call the following command:

    Shutdown -s

    30 seconds after execution, the system will shut down. In addition, using the same command, but with a different parameter, you can not turn off the computer, but restart it. This is what it will look like:

    Shutdown -r

    Again, note that the remaining parameters for the shutdown and reboot commands are similar, so we will not repeat each set twice, but will go through the entire process automatic shutdown computer using the command example shutdown -s, keeping in mind that the same applies to the team shutdown -r

    Now let's move on to improving the command and adding additional parameters to it.

    shutdown command options

    The material described in the article is applicable to most versions used today operating system from Microsoft. Commands and methods for executing them allow you to Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista and still retaining its faithful user Windows XP.

    Now let's look at the main parameters of the shutdown command that we will use:

    • -s automatically turn off the computer;
    • -r the main parameter that allows automatically restart your computer;
    • -a the main parameter that allows cancel the planned action of shutting down or restarting the computer;
    • -t allows you to set delay time in seconds before turning off or restarting the computer. It is possible to assign a value in the range from 0 to 315360000 (10 years). The default value is 30;
    • -f forced closure running applications without warning users. Not the best main parameter, but it can be useful because it helps to avoid canceling shutdown or rebooting of the computer due to frozen programs.

    For the purposes of getting acquainted with the method of automatically turning off a computer, this will be enough for us. Below we will add other commands to the above set to make use of the function shutdown even more convenient.
    Complete list of parameters for shutdown can be seen by running the following command in the console:

    Shutdown/?

    Automatically shutdown the computer after a certain time

    So let's move on to practical application information we collected in the first two chapters.

    Let's say we're watching a movie and realize that we can fall asleep without turning off the computer. We need to the computer turned off by itself in 30 minutes. To do this, you need to run the following command (we remember that this can be done not only in the command line, but also through the Run utility or in the Start menu):

    Shutdown -s -f -t 1800

    The parameters used are already familiar to us. And the meaning 1800 sets the time value in seconds after which the work will be shut down. That is, 1800 seconds = 1800 seconds / 60 seconds in a minute = 30 minutes. There shouldn't be any problems with this. After executing the command we will get system notification, that shutdown is scheduled

    In addition, 10 minutes before shutdown, regardless of the planned reason (shutdown or reboot), we will receive an additional warning from the Windows system

    But what if, say, after 15 minutes we realize that we won’t have time to finish watching the film and need to cancel the automatic shutdown? To refuse scheduled completion Windows operation , you need to run the following command:

    Shutdown -a

    Immediately after executing the command, a notification will appear indicating that the automatic shutdown of the computer has been canceled

    This, in fact, is all you need to know to automatically turn off your computer through specified time. But entering a command into the console every time is not very convenient, so below we will figure out how to write bat file for automatically shutting down the computer or restarting it.

    Body file for automatically shutting down the computer

    But you can improve the bat files a little more and make one out of three, converting it into a tiny program. This is what we will do below.

    We create a program to automatically turn off the computer

    On at the moment we have three batch files, each of which performs its own function: turning off the computer, rebooting and canceling planned actions.
    First, let's write the main part of the new single bat file. The idea would be to ask the user which one three actions needs to be completed, and then move on to the part that is responsible for the desired function.

    We will set the choice of function with the following line (it, like the entire file, can be edited at your discretion, as will be more convenient):

    Set /p answer="turn off - 1, reboot - 2, cancel - 0: "

    Here we set a new variable answer, the value of which is entered each time the file is launched and confirmed by pressing the Enter key.
    We move to the required part of the bat code with the command goto, V in this case the line will look like this:

    Goto %answer%

    The beginning of each independent part will be marked, respectively, as :1 , :2 And :0
    For proper execution, let’s complete each part of the code without a command pause, and the team exit by adding a two second delay before closing the window:

    TIMEOUT /T 2 exit

    And finally, let’s add coloring of the text in different colors, depending on the command being executed:

    At the output we will get the following code:

    Echo off chcp 1251 set /p answer="turn off - 1, reboot - 2, cancel - 0: " goto %answer% :1 set /p min_off="Turn off the computer in (minutes): " set /A sec_off="% min_off% * 60" color C echo The computer will be turned off in %min_off% minutes shutdown -s -f -t %sec_off% TIMEOUT /T 2 exit:2 set /p min_re="Restart the computer in (minutes): " set /A sec_re="%min_re% * 60" color E echo The computer will restart in %min_re% minutes shutdown -r -f -t %sec_re% TIMEOUT /T 2 exit:0 color A echo Scheduled shutdown of Windows canceled shutdown -a TIMEOUT / T 2 exit

    Each command has already been described above. Here's how it works:

    1. We are launching a batch file.
    2. In response to the question about choosing a function, enter 1 , 2 or 0 . , confirm the entry with the Enter key.
    3. The console will jump to the appropriate part of the code and, if it is a shutdown or reboot, will ask in how many minutes to perform the required action.
    4. Then the entered value is converted into seconds and added to the command, the parameters of which determine the planned action.

    Download ready bat file to automatically shut down the computer can be found from the attached archive: .

    For convenience, you can pack the resulting batch file into an SFX archive and add an icon to it. In the end it will be simple portable program to automatically shut down and restart your computer after a specified time interval: .