2个回答
展开全部
@echo off
setlocal enabledelayedexpansion
for /f "delims=` tokens=* eol=`" %%a in (a.txt) do (
set str=%%a
set str=!str:~1,4!
set str1=!str:~0,2!
set str2=!str:~3,1!
set str=!str1!!str2!
echo !str!>>b.txt
)
set ctr=0
for /f "delims=` tokens=* eol=`" %%a in (b.txt) do (
set /a ctr+=1
for %%b in (!ctr!) do (set num%%b=%%a)
)
echo !num1!
for /l %%a in (1,1,!ctr!) do (
set /a n=%%a+1
for /l %%b in (!n!,1,!ctr!) do (
if "!num%%a!"=="!num%%b!" set "num%%b="
)
)
for /l %%a in (1,1,!ctr!) do (
if defined num%%a echo !num%%a!>>c.txt
)
del /f /q b.txt >nul
pause
需要将五位数存放在与这个bat位置相同的a.txt中,一行一个数字,结果保存在c.txt中。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询