Hehe, I searched hard all afternoon and still couldn't find a suitable one, so I hope everyone can help me.
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
for /f "skip=3 delims=" %i in (a.txt) do echo %i
for /f "delims=: tokens=1,2" %i in ('findstr /n . a.txt') do if "%i"="4" set %i=%j
echo The content of the fourth line is:%4%
@echo off
echo Test environment CMD@WinXP sp2, if you use it on other systems please test first!
echo String searching is needed during execution, please do not modify the related files
echo.
echo Running... please wait patiently
echo ----------------------------Execution info----------------------------
For /f %%a in ('dir /b *.ps') do call :name "%%a"
echo ----------------------------------------------------------------
echo Execution complete, press any key to exit
pause >nul
exit
:name
set name=%~n1
if not == goto :eof
for /f "tokens=2 delims=. " %%i in ('findstr pdn.pdf$ %name%.ps') do set file=%%i.xml
set xmlpath="%appdata%\NewspaperDirect\PressReader\queue\%file%"
for /F "tokens=*" %%c in ('type %xmlpath% ^|find "<title>"') do set paper="%%c"
set paper=%paper:~8,-9%
set paper=%paper: = %
set name=%paper% %name:~0,4%-%name:~4,2%-%name:~6,2%
rename %1 "%name%.ps" &&echo %~n1.ps renamed to %name%.ps
goto :eof
@echo off
echo Test environment CMD@WinXP sp2, if you use it on other systems please test first!
echo String searching is needed during execution, please do not modify the related files
echo.
echo Running... please wait patiently
echo ----------------------------Execution info----------------------------
For /f %%a in ('dir /b 20*.ps') do call :name "%%a"
echo ----------------------------------------------------------------
echo Execution complete, press any key to exit
pause >nul
exit
:name
set name=%~n1
if not == goto :eof
for /f "tokens=2 delims=. " %%i in ('findstr pdn.pdf$ %name%.ps') do set file=%%i.xml
set xmlpath="%appdata%\NewspaperDirect\PressReader\queue\%file%"
for /F "tokens=*" %%c in ('type %xmlpath% ^|find "<title>"') do set paper="%%c"
set paper=%paper: = %
set paper=%paper:~8,-9%
set name=%paper% %name:~0,4%-%name:~4,2%-%name:~6,2%
rename %1 "%name%.ps" &&echo %~n1.ps renamed to %name%.ps
goto :eof