How would I go about changing the destl variable to uppercase before it is used. I assume some sort of character swap, however I couldn\'t get it working. C
If you have any POSIX utilities installed on Windows, like many developers (e.g., GNUWin utilities at https://sourceforge.net/projects/gnuwin32/)
@echo off
SETLOCAL EnableDelayedExpansion
echo Before: SCEINST is: %SCEINST%
set upper=
for /f "usebackq delims=" %%g in (`echo %SCEINST% ^| tr [:lower:] [:upper:]`) do (
SET upper=%%g
:: get rid of any leading whitespace
set upper=!upper: =!
goto :done
)
:done
echo After: SCEINST (in upper) is now: !upper!
----------OUTPUT----------
Before: SCEINST is: scprd
After: SCEINST (in upper) is now: SCPRD
This is probably the fastest way to convert string to upper case using batch file - it uses a macro ,it stores only the upper case letters in the loop using the way of how batch replaces strings and stores the produced string in a variable called result
:
@echo off
set UpperCaseMacro=for /L %%n in (1 1 2) do if %%n==2 (for %%# 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 set "result=!result:%%#=%%#!") else setlocal enableDelayedExpansion ^& set result=
set "string=SOme STrinG WiTH lowerCAse letterS and UPCase leTTErs"
%UpperCaseMacro%%string%
echo %result%