不考虑最后一位为0的退位计算:- @echo off&setlocal enabledelayedexpansion
- >b.txt (
- for /f "tokens=1,2" %%a in (a.txt) do (
- set "d1=%%~na"&set "d2=%%~nb"
- set "p1=%%~xa"&set "p2=%%~xb"
- set /a "n1=!p1:.=!-1,n2=!p2:.=!-1"
-
- :test
- if !d1!.!n1! neq !end! (
- if defined start echo;!start! !end!
- set start=%%a
- )
-
- set end=!d2!!p2!
- ))
- if defined d1 (
- set "d1="
- call :test>>b.txt 2>nul
- ) else exit/b
- pause
复制代码
|