批处理_大小写字母转换

@echo off
:main
cls
set str=
set /p str=
if not defined str exit
cls
echo.
echo former:"%str%"
:: 转换成大写
:: for %%i in (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 call set str=%%str:%%i=%%i%%
:: 转换成小写
for %%i in (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 call set str=%%str:%%i=%%i%%
echo.
echo.
echo after:"%str%"
echo.
echo next...
pause>nul
goto main

:change
call set "str=%%str:%char1%=%char2%%%"

posted @ 2021-11-26 10:16  江南王小帅  阅读(586)  评论(0)    收藏  举报