
CODE: [Copy to clipboard]@echo off & setlocal EnableDelayedExpansion
set file=c:\a.txt
for /f "usebackq" %%a in ("%file%") do (
set str=000000000%%a
if not defined . (
set .= & >"%file%" echo !str:~-10!
) else (
>>"%file%" echo !str:~-10!
)
)
CODE: [Copy to clipboard]@echo off
set "var=0000000000"
for /f "delims=" %%a in ('more +10^<%~fs0') do (
set "str=%%a"
setlocal enabledelayedexpansion
set "str=%var%!str!"
echo !str:~-10!
endlocal
)
pause&goto :eof
112
123
12345
CODE: [Copy to clipboard][ Last edited by glbosom on 2008-12-25 at 23:41 ]@echo off&setlocal enabledelayedexpansion
for /f %%a in ('^more ^<a.txt') do (
set txt=000000000%%a
echo !txt:~-10,10!>>a1.txt
)
del /q a.txt&ren a1.txt a.txt
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |