trzcopy

@echo off
cd /d %~dp0
setlocal enabledelayedexpansion

set aa=伟大的中国!我为你自豪
echo 替换前:%aa%
echo 替换后:%aa:中国=中华人民共和国%
echo aa=%aa%
echo %aa%
set aa=%aa:中国=中华人民共和国%
echo aa=%aa%

cd logs
dir /o:-d tomcat8.0.29-stdout*.* /b >wj.txt
set /p firstRow=<"wj.txt"
echo %firstRow%
set bb=logs\%firstRow%
echo %bb%
del wj.txt

echo %date:~0,4%-%date:~5,2%-%date:~8,2%

for /f "tokens=1,2 delims=:" %%a in ('findstr /n %date:~0,4%-%date:~5,2%-%date:~8,2% %firstRow%') do (
    set /a Line+=1
    set L_Num=%%~a
    set Str=%%~b
    if !Line! gtr 1 goto Next
)
exit

:Next
echo 行号:%L_Num%
echo 内容:%Str%
@set /a a=3
@set /a b=2
@set /a c=1
@set /a d=%a%*%b%-%c%
echo %d%
@set /a e=%L_Num%
@set /a f=%e%-%b%
echo %f%
echo %firstRow%
more +%f% %firstRow%> F:logs omcat8.0.29-stdout-%date:~0,4%%date:~5,2%%date:~8,2%.txt.log
exit

原文地址:https://www.cnblogs.com/wbly2019/p/14823081.html