本帖最后由 qixiaobin0715 于 2022-5-12 08:25 编辑
代码适用除字母数字以外的字符必须连续,不能分开:- @echo off
- set numbers=0 1 2 3 4 5 6 7 8 9
- set letters=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- setlocal enabledelayedexpansion
- for /f "tokens=2 delims=_" %%a in (123.txt) do (
- set str1=%%a
- for %%b in (%letters% %numbers%) do set str1=!str1:%%b=!
- echo,!str1!>>123-z.txt
- set str2=%%a
- for %%c in (%letters% !str1!) do set str2=!str2:%%c=!
- echo,!str2!>>123-a.txt
- set str3=%%a
- for %%d in (%numbers% !str1!) do set str3=!str3:%%d=!
- for %%i in (%letters%) do set str3=!str3:%%i=%%i!
- echo,!str3!>>123-1.txt
- )
- pause
复制代码
|