- @echo off
- set "U_L=a:A b:B c:C d:D e:E f:F g:G h:H i:I j:J k:K l:L m:M n:N o:O p:P q:Q r:R s:S t:T u:U v:V w:W x:X y:Y z:Z"
- for /f "delims=" %%i in ('dir /s /b') do (
- echo %%i
- call :toUpper "%%~ni"
- call echo RENAME TO: %%newStr%%%%~xi
- call rename "%%~i" "%%newStr%%%%~xi"
- echo ----------------
- )
- pause&exit
-
- :toUpper
- set "s=%~1"
- set "tmpStr=%s%" & set "newStr=" & set "up=1"
- for %%i in (%U_L%) do for /f "tokens=1,2 delims=:" %%a in ("%%i") do call set "tmpStr=%%tmpStr:%%a=%%b%%"
- :loop
- if "%s:~0,1%"=="[" set "up=0"
- if "%s:~0,1%"=="]" set "up=1"
- if "%up%"=="0" ( set "newStr=%newStr%%s:~0,1%" ) else ( set "newStr=%newStr%%tmpStr:~0,1%" )
- set "s=%s:~1%" & set "tmpStr=%tmpStr:~1%"
- if not "%s%"=="" goto :loop
复制代码
|