本帖最后由 pcl_test 于 2015-4-15 15:37 编辑
回复 29# wbkl - @echo off
- setlocal enabledelayedexpansion
- for /f "skip=2 tokens=1,2* delims=~" %%a in ('type "测试A.txt"') do (
- set s=
- set t=
- set "name=%%b"
- set str=%%bfedcba9876543210
- set/a len=0x!str:~15,1! &set/a len-=1
- for /l %%x in (0 1 !len!) do (
- for /f "skip=2 tokens=1* delims=: " %%i in ('find "!name:~%%x,1!" %0') do (
- set "sm=%%j"
- if "!sm:~,2!" == "zh" (
- set sm=!sm:zh=Zh! &set "s=!s!!sm:~,2!"
- ) else if "!sm:~,2!" == "ch" (
- set sm=!sm:ch=Ch! &set "s=!s!!sm:~,2!"
- ) else if "!sm:~,2!" == "sh" (
- set sm=!sm:sh=Sh! &set "s=!s!!sm:~,2!"
- ) else (
- for %%t in (bB pP mM fF dD tT nN lL gG kK hH jJ qQ xX rR zZ cC sS yY wW) do (
- set "t=%%t"
- if "!t:~,1!" == "!sm:~,1!" set "sm=!t:~1,1!" &set "s=!s!!sm:~,1!"
- ))))
- echo,%%a~~%%b~~!s!~~%%c
- )
- pause
- ::张 zhang
- ::三 san
- ::李 li
- ::四 si
- ::王 wang
- ::五 wu
- ::马 ma
- ::六 liu
- ::赵 zhao
- ::七 qi
- ::杨 yang
- ::八 ba
- ::孙 sun
- ::九 jiu
- ::吴 wu
- ::十 shi
复制代码
|