It is necessary to make a batch file that will cut down the computer in the interval from 10 pm to 7 am. Never wrote them, please help. The batnik should check the system time when starting the computer and cut it down right away
Closed due to the fact that the essence of the issue is not clear to the participants of AK ♦ , Denis , Pavel Mayorov , Denis Bubnov , fori1ton 1 Feb '17 at 8:58 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- If you are not an expert and are not going to become one, then it is best for you to go to the freelance market so that you can get a turnkey message. Here they do not like questions in the style of “write the code for me”, but they help to understand if the questioner himself makes efforts. Start writing, ask specific questions - the chances of getting help will be much higher. - AK ♦
- @AK Yes, what is the freelancing exchange? This is a task almost for beginners. Googling a little bit and that's it. - Byulent
- oneyou do not need a batch file, but a sheduler - Sublihim
- In general, Windows has parental controls and with it you can perform this task - users
- one@ stack-it Using software for what can be done with the help of the operating system is a moveton. - ilyaplot
2 answers
Batnik is not needed. Create a task in the scheduler. The name is free, but better like "Turn off at 22:00". Trigger - daily at 22:00. The action is to start the %SystemRoot%\System32\shutdown.exe /s /t 60 /f program (60 is for so many seconds the system will wait for the shutdown /a cancel shutdown /a , if cancellation is not needed, set zero). General - select "Perform regardless of user registration" and select the "Run with higher rights" checkbox. Almost everything is proper.
It remains only to block the launch (more precisely, authentication) at the forbidden time. This is already done by the parental control settings - by prohibiting time from 22 in the evening to 7 in the morning for each account. Moreover, only those accounts that are of the type “Regular user” can be blocked - accounts with administrative privileges (and / or members of other local groups, except the Users group) are not subject to parental control restrictions.
@echo off IF %time:~0,2%%time:~3,2% GEQ 2200 GOTO poweroff IF %time:~0,2%%time:~3,2% LEQ 0700 GOTO poweroff GOTO end :poweroff shutdown /s /t 0 :end Paste this script into the bat file, and add the bat file to autoload and after every 10 minutes. It is better to do this through scheduled tasks. The script is written only for self-development. In the comments are right, you need to go with the money for freelancing.