If you want to be unable to enter the system at a certain point in time (such as 12:30), you can use "at 12:30 shutdown -s"; but it feels meaningless like this;
If you want to be unable to enter the system during a certain time period (such as between 8:00 and 10:30), you can put the following script into the startup to start with the computer
@echo off
setlocal enabledelayedexpansion
for /f "tokens=1,2 delims=:" %%i in ('time /t') do (
set hour=x%%i& set minute=x%%j
set hour=!hour:~-2!& set minute=!minute:~-2!
set now=!hour!!minute!
if !now! gtr 800 if !now! lss 1030 shutdown -s
)
Later, when testing, a small problem was found, that is, the & after set should be closely followed by the previous sentence, and no space should be left, otherwise, it will cause judgment errors.
[
Last edited by namejm on 2006-8-18 at 13:37 ]
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。