回复 1# Linux9253 - set count=""
- for /f %%a in ('type %hqlopwd%\count.log') do set count=%%a
- if %Number% lss 2 goto check
- if %count% == # goto check
- set n=
- for /f "tokens=8" %%i in (%hqlopwd%\%Serfile%) do (set /a n+=1 &if !n! leq 2 set Systime=%%i)
- set localF=%time:~3,2%
- set localM=%time:~6,2%
- set SystimeF=%Systime:~3,2%
- set SystimeM=%Systime:~6,2%
- if "--" == "%SystimeM%" if "--" == "%SystimeF%" echo # > %hqlopwd%\count.log & start "cmd /c" %0 && exit
-
- set /a grpeq=%localM% - %SystimeM%
- set grpje=%grpeq:~0,1%
- if %grpje% == - set grpeq=%grpeq:~1%
- if %localF% == %SystimeF% if %grpeq% gtr 15 echo # > %hqlopwd%\count.log & start "cmd /c" %0 && exit
-
- set /a grp=%localF% - %SystimeF%
- set grpri=%grp:~0,1%
- if %grpri% == - set grp=%grp:~1%
- if %grp% geq 1 if 45 gtr %SystimeM% echo # > %hqlopwd%\count.log & start "cmd /c" %0 && exit
-
- :check
- if %Number% gtr 60 echo .>%hqlopwd%\count.log
复制代码 这是代码的一部分、是个bat文件、也是要处理的文件、但这里有跳转- :check
- if %Number% gtr 60 echo .>%hqlopwd%\count.log
复制代码 这个是我现在用的代码、可以显示空行- copy /y %FileName% %FileName%.bak & set a=
- (for /f "tokens=1* delims=:" %%m in ('findstr /n .* %FileName%') do (set line=%%n
- if "!line!"=="rem var1" (echo.%%n)
复制代码 但问题是、这段代码会把开头的:号去掉、这样程序就出错了、会变成- check
- if %Number% gtr 60 echo .>%hqlopwd%\count.log
复制代码 所以求大神帮忙、。。。 |