不好意思,复制代码测试的时候搞错了。把bamboo的复制进去了……汗,我的是这个- @echo off&setlocal enabledelayedexpansion
- :begin
- cls
- set /p t=请输入时间,格式(00:00-23:59):
- for /f "tokens=1,2 delims=:" %%i in ("%t%") do (
- set h1=%%i
- set m1=%%j
- )
- for /l %%k in (100,1,123) do (
- set h2=%%k
- set h3=!h2:~1,2!
- if "!h1!"=="!h3!" set p=0
- )
- :1
- for /l %%n in (100,1,159) do (
- set m2=%%n
- set m3=!m2:~1,2!
- if "!m1!"=="!m3!" set q=0
- )
- if not defined p ( echo 时间格式错误&pause>nul&goto begin) else (
- if defined q (echo 时间格式正确) else (
- echo 时间格式错误&pause>nul&goto begin))
- pause>nul
复制代码 看了一下,大同小异 |