除了数组,其它的做解决了~~~- goto :ansi
- rem UTF-8 编码支持
- chcp 65001
- cls
-
- :ansi
- @echo off
-
-
- setlocal enabledelayedexpansion
-
-
- set /p "strFile=请拖入处理文本:"
- if not exist !strFile! (
- echo;"!strFile!" 文件不找不到!!
- exit /b
- )
-
- rem 定义用于命名的字符表
- set ASC=ABCDEFGHIJKLMNOPQRSTUVWXYZ
- set n=0
-
- rem 例外情况定义
- set exception=Extra Button
-
- (
- for /f "tokens=1* delims==" %%a in (!strFile!) do (
- set s1=%%a
- set s2=%%b
- set z=
- for %%k in (%exception%) do (if "!s1:%%k=!" neq "!s1!" (set z=y))
- if "!z!!s1:~-5!" equ " name" (
- set s3=!s2:^"= !
- for /f "tokens=1 delims= " %%c in ("!s3!") do (
- if defined #%%~c (
- echo;%%a=%%b
- ) else (
-
- call :getn !n! ss
- set sa=%%~c
-
- rem 保留"."后面的尾巴
- if "!sa:.=!" neq "!sa!" set ss=!ss!.!sa:*.=!
-
- echo;!s1!="!ss!" %%d
- set $!n!=!ss!囧%%~c
- set #%%~c=!ss!
- set /a n+=1
- )
- )
-
- ) else (
- if defined s2 (echo;!s1!=%%b) else (echo;!s1!)
- )
-
- )
- ) >temp.txt
-
- set/a n-=1
-
- (
- for /f "tokens=1,*" %%a in (temp.txt) do (
-
- set str=%%b
- if defined str (set str=%%a !str: =!) else set str=%%a
-
- for /l %%1 in (0,1,!n!) do (
- for /f "tokens=1,2 delims=囧" %%b in ("!$%%1!") do (
- set str=!str:"%%c"="%%b"!
- set str=!str:@%%c=@%%b!
- set str=!str:#%%c=#%%b!
- )
- )
- echo;!str!
- )
-
- ) > 结果.txt
-
- start 结果.txt
-
- rem 查看有多少个更改
-
- set $
-
- pause
-
- exit /b
-
- rem 计算临名字,可加上前缀,A-Z,AA-ZZ,AAA-ZZZ,AAAA-ZZZZ ……
- :getn
-
- (set L=%1
- set M=%1
- set %2=)
-
- :loop
- set /a M=L %% 26
- set %2=!%2!!ASC:~%M%,1!
- if !M! neq !L! set /a L=L/26&goto :loop
- goto :eof
复制代码
|