
CODE: [Copy to clipboard]3@echo off&setlocal enabledelayedexpansion
for /f %%a in ('dir/b *.MID') do (
set tmp=%%~na
set tmp=!tmp:GAME=!
if !tmp! lss 10 set tmp=0!tmp!
ren %%~a !tmp!%%~xa
)
CODE: [Copy to clipboard]@echo off&setlocal enabledelayedexpansion
for /f %%a in ('dir/b *.MID') do (
set str=%%~na
set str=!str:GAME=!
call :A-Z
ren %%~a !str!%%~xa
)
exit
:A-Z
set N=0
for /f %%n (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) do (
set /a N+=1
if "!str!" == "!N!" set str=%%n&goto :eof
)
goto :eof
CODE: [Copy to clipboard]发现一个好玩的set a=xabcdefghi
for /f "delims=GAME." %%i in ('dir /b game*.mid') do (
set /a b=%%i%%10,c=%%i/10
call :rrr %%i %%b%% %%c%%)
goto :eof
:rrr
call echo ren game%1.mid game%3%%a:~%2,1%%.mid
goto :eof
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |