- @echo off&setlocal enabledelayedexpansion
- ::右边最多只能有20个空格
- for /f "tokens=1,*" %%i in (a.txt) do (
- set num=0
- set blank=
- set a=%%j
- for %%z in (%%j) do (set fin=%%z)
- for /l %%x in (1,1,20) do (
- set blank= !blank!
- if "!a:~-%%x!"=="!blank!" set /a num+=1
- )
- call set b=%%a:~0,-!num!%%#
- call set fina=%%b:!fin!#=%%
- echo !fin! !fina!
- )
- pause
复制代码
|