Posted on 2010-05-17 10:21
S.l.e!ep.¢% 阅读(964)
评论(0) 编辑 收藏 引用 所属分类:
DOS
批处理, 小写转大写
@echo off
:: 稍微修改一下代码就可以实现大写转小写
set str1=abcdefghijklmnopqrstuvwxyz
set str2=ABCDEFGHIJKLMNOPQRSTUVWXYZ
:main
cls
set str=
set /p str= 请输入字符串(退出请直接按回车):
if not defined str exit
cls
echo.
echo 转换前:"%str%"
echo.
for /l %%i in (0,1,25) do (
call set char1=%%str1:~%%i,1%%
call set char2=%%str2:~%%i,1%%
call :change
)
echo ____________________________________________
echo.
echo 转换后:"%str%"
echo.
echo 按任意键进行下一次演示
pause>nul
goto main
:change
call set "str=%%str:%char1%=%char2%%%"
goto :eof