Windows batch command to ignore case sensitivity in variables

VariablesBatch FileCase SensitiveCode Formatting

Variables Problem Overview


I have a set of variables I allow some people I work with to edit. These are True (T) and False (F) values, but I have some people that insist on putting t and f instead of the upper case values respectively.

I use the following workaround code to properly set uppercase values:

IF '%dotnet35%'=='f' set dotnet35=F
IF '%dotnet35%'=='t' set dotnet35=T
IF '%dotnet40%'=='f' set dotnet40=F
IF '%dotnet40%'=='t' set dotnet40=T
IF '%regedit%'=='f' set regedit=F
IF '%regedit%'=='t' set regedit=T
IF '%SSL%'=='f' set SSL=F
IF '%SSL%'=='t' set SSL=T

This is however extremely bulky and it's not easy on the eyes... is there any other way of doing this without using VBS or any other programming language?

Variables Solutions


Solution 1 - Variables

Read HELP IF : the /I switch, if specified, says to do case insensitive string compares. The /I switch can also be used on the string1==string2 form of IF.

So try IF /I %SSL%==F ...

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionrud3yView Question on Stackoverflow
Solution 1 - VariablesPA.View Answer on Stackoverflow