本帖最后由 smss 于 2020-5-8 22:51 编辑
- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('dir /ad /b ^|findstr /i "[0-9]"') do (set str=%%a&set str_a=!str!&set str_b=!str:.=!
- for /l %%a in (0,1,9) do set str_a=!str_a:%%a=!
- call:calc !str_a!
- echo 源值!str!中包含的数字为!str_b!
- for /f "delims=" %%c in ('dir /a-d /b "%%a\*"') do ren "%%a\%%c" "!str_b! %%c")
- pause&exit
- :calc
- set n=0&set "s=%~1"
- :loop
- set "t=!s:~%n%,1!"
- if "%t%"=="" (set "str_b=!str_b:"=!"
- goto :eof)
- set "str_b=!str_b:%t%=!"&set /a n+=1
- goto loop
复制代码
|