方法如下:
@echo off&SetLocal EnableDelayedExpansion
Set hour=%Time:~,2%
Set minute=%Time:~3,2%
Set /a minute+=10
::以下代码处理两个临界点:分钟数为50-59,小时数为23
Set /a n=(minute/60)
If %n%==1 (
Set /a hour+=1 & Set /a minute%%=60
Set /a h=!hour!%%24
If !h!==0 Set hour=0
Set str=!hour!:!minute!
) Else (
Set str=%hour%:%minute%
)
::以下代码替换文本内容,假设要处理的文本为1.txt
(For /f "delims=" %%i in (1.txt) do (
echo %%i| Find /i "time=" >nul
If !errorLevel!==0 (echo time=%str%) Else (echo %%i)
))>11.txt
start 11.txt
pause