- 帖子
- 565
- 积分
- 1053
- 技术
- 153
- 捐助
- 0
- 注册时间
- 2022-6-20
|
@echo off
@rem 借用plp626大神的_strlen函数( http://www.bathome.net/thread-11799-1-7.html )
set "Str="
setlocal enabledelayedexpansion
set "_strlen=set $=^!#1^!#&set ##=&(for %%a in (4096 2048 1024 512 256 128 64 32 16)do if ^!$:~%%a^!. NEQ . set/a##+=%%a&set $=^!$:~%%a^!)&set $=^!$^!fedcba9876543210&set/a##+=0x^!$:~16,1^!"
for /f "usebackq tokens=*" %%a in ("%~1") do (
set "#1=%%a"
(%_strlen%)
for /L %%b in (0,1,!##!) do (
set "c=!#1:~%%b,1%!"
if !c! neq a (
set "Str=!Str!!c!"
) else (
set/a No+=1
set "Str=!Str!!c!!No!"
)
)
echo;!Str!
set "Str="
)
endlocal &pause &exit/b |
|