- @echo off&setlocal EnableDelayedExpansion
- set file=%1
- echo 正在对文件%file%中的数据行字符串倒序输出
- cd.>2.txt
- for /f "delims=" %%i in ('type "%file%"') do (
- set str=%%i
- echo !str!
- set n=0&set length=&call :str_length
- set x=1&set str2=&call :str2
- echo !str2!
- echo.!str2!>>2.txt
- )
- start 2.txt
- exit
- :str_length
- if "!str:~%n%,1!"=="" goto :eof
- set /a n+=1
- goto :str_length
- :str2
- if %x% gtr %n% goto :eof
- set str2=!str2!!str:~-%x%,1!
- set /a x+=1
- goto :str2
复制代码
|