本帖最后由 qixiaobin0715 于 2021-12-23 19:46 编辑
回复 3# Nero
源文本为a.txt,生成b.txt:- @echo off
- setlocal enabledelayedexpansion
- (for /f "delims=" %%a in (a.txt) do (
- set var1=%%a
- set var2=%%a
- for /l %%i in (0,1,9) do set "var1=!var1:%%i=!"
- set "var1=!var1:%%=!"
- set "var1=!var1: =!"
- call :a
- ))>b.txt
- pause
- goto :eof
- :a
- for /f "tokens=1* delims=%var1% " %%j in ("!var2!") do (
- set var=!var! %%j
- if not "%%k"=="" set "var2=%%k"&goto :a
- echo,!var:~1!
- set var=
- )
复制代码
|