自己都没理顺思路,叫人如何写。这样试试,后面是两字符的取3组,余者取两- @echo off&setlocal enabledelayedexpansion
- (for /f "tokens=1* delims=:" %%a in (a.txt) do (
- set "str=%%b"
- set "str=!str::= !"
- for %%i in (!str!) do (
- for /f "delims=/" %%a in ("%%i") do (
- set "str=%%a"
- set "str=!str:.= !"
- set m=0
- for %%a in (!str!) do (
- set/a m+=1
- set "#!m!=%%a."
- set "tmp=%%a"
- )
- if "!tmp:~2!"=="" (set/a n=m-2) else set/a n=m-1
- set "e="
- for /l %%a in (!n!,1,!m!) do set "e=!e!!#%%a!"
- echo,!e:~,-1!
- )
- )
- ))>b.txt
复制代码
|