In tip 8971, I scripted ChgCase.bat to change a string to all upper case or all lower case.

I have re-written ChgCase.bat to change a string to all upper case or all lower case.

The syntax for using ChgCase.bat is:

\[call\] ChgCase U|L VarName

Where:

<b>U</b>        changes the string in <b>VarName</b> to upper case.
<b>L</b>        changes the string in <b>VarName</b> to lower case.

<b>VarName</b>  is the name of the variable, <b>NOT %VarName%</b>, that contains the string to be converted.

Example:

set VarName=abc123xyz
call ChgCase U VarName

will convert the string in VarName to ABC123XYZ.

ChgCase.bat contains:

@echo off
if \{%2\}==\{\} goto :err
if exist "%TEMP%\ChgCase.vbs" goto doit
@echo.Dim objArguments, ul, iString>"%TEMP%\ChgCase.vbs"
@echo.Set objArguments = Wscript.Arguments>>"%TEMP%\ChgCase.vbs"
@echo.ul=objArguments(0)>>"%TEMP%\ChgCase.vbs"
@echo.iString=objArguments(1)>>"%TEMP%\ChgCase.vbs"
@echo.if UCase(ul) = "U" Then>>"%TEMP%\ChgCase.vbs"
@echo. WScript.Echo UCase(iString)>>"%TEMP%\ChgCase.vbs"
@echo.ELSE>>"%TEMP%\ChgCase.vbs"
@echo. WScript.Echo LCase(iString)>>"%TEMP%\ChgCase.vbs"
@echo.End If>>"%TEMP%\ChgCase.vbs"
goto doit
:err
@echo Syntax: ChgCase U^|L VarName
goto :EOF
:doit
if /i \{%1\} EQU \{U\} goto OKul
if /i \{%1\} NEQ \{L\} goto err
:OKul
for /f "Tokens=*" %%a in ('cscript //nologo "%TEMP%\ChgCase.vbs" %1 %%%2%%') do (
 set %2=%%a
)