if "%~1"=="" start /min "" "%~0" h&exit
There is a batch processing first sentence is this I read for a long time did not understand,
@echo off
for /f "delims=: tokens=1*" %%i in ('time /t') do call :Comp %%i %%j
goto :eof
:Comp
set /a Hour=%1
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 01 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 02 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 03 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 04 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 05 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 06 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 07 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 13 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 14 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 15 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 16 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 17 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 23 (d:\ntsd\shutdown.exe & goto :eof)
shutdown.exe is a shutdown program
Can simplify here,, IF I have not found such a statement,, greater than and less than,,
Otherwise, I would not use this stupid method,
Also 4 floors said that, from 8:00 - 12:00 in the morning, from 18:00 - 22:00 in the evening can run, all other times are shut down
How to write this batch processing more simply!
[ Last edited by zhaoyi on 2008-10-28 at 23:28 ]
There is a batch processing first sentence is this I read for a long time did not understand,
@echo off
for /f "delims=: tokens=1*" %%i in ('time /t') do call :Comp %%i %%j
goto :eof
:Comp
set /a Hour=%1
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 01 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 02 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 03 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 04 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 05 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 06 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 07 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 13 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 14 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 15 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 16 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 17 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 00 (d:\ntsd\shutdown.exe & goto :eof)
if %Hour% equ 23 (d:\ntsd\shutdown.exe & goto :eof)
shutdown.exe is a shutdown program
Can simplify here,, IF I have not found such a statement,, greater than and less than,,
Otherwise, I would not use this stupid method,
Also 4 floors said that, from 8:00 - 12:00 in the morning, from 18:00 - 22:00 in the evening can run, all other times are shut down
How to write this batch processing more simply!
[ Last edited by zhaoyi on 2008-10-28 at 23:28 ]


I'm a super noob