Is there any command to convert from upper case to lower case. I would like to convert windows system variable %USERNA开发者_如何学编程ME% to lower case in a single command.I am not using NT. Thanks in advance
@echo off
set DB_NAME=r012azertyZZ
CALL :CONV_VAR_to_MAJ DB_NAME
echo.DB_NAME=[%DB_NAME%]
EXIT /B 0
:CONV_VAR_to_MAJ
FOR %%z 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 %~1=%%%~1:%%z=%%z%%
EXIT /B 0
I found this and this pages:
REM MS-DOS Version
SET STRING=Whatever You Want
SET OLDPATH=%PATH%
PATH %STRING%
SET STRING=%PATH%
PATH %OLDPATH%
SET OLDPATH=
ECHO.%STRING%
Or
REM NT Version
SET STRING=Whatever You Want
IF [%STRING%]==[] GOTO:EOF
SET STRING=%STRING:a=A%
SET STRING=%STRING:b=B%
•
•
•
SET STRING=%STRING:y=Y%
SET STRING=%STRING:z=Z%
SET STRING
Since I don't have an MS-DOS box here, I couldn't test it, sry.
精彩评论