批处理处理字符串的大小写转换

@echo off&setlocal enabledelayedexpansion
set str=aA bB cC dD eE fF gG hH iI jJ kK lL mM nN oO pP qQ rR sS tT uU vV wW xX yY zZ
for %%i in (%str%) do set "var=%%i" & set !var:~0,1!=%%i


set "TS="
set /P TS=请输入测试字符:
for /l %%i in (0 1 100) do (
set "T3=!TS:~%%i,1!"
if "!T3!"=="" goto :Res
if defined !T3! (
call set T2=%%!T3!:~0,1%%
if "!T3!"=="!T2!" call set T2=%%!T3!:~1,1%%) else set "T2=!T3!"
echo "!T2!"=="!T3!"
if %%i GTR 3 set "T2=!T3!"
set Res=!Res!!T2!

)
:Res
echo.&echo 转换前:!TS!
echo 转换后:!Res!
pause>nul

你可能感兴趣的:(DOS)