Ignore 'case' of input when comparing


  1. Posts : 232
    Win 10 Ver 1903
       #1

    Ignore 'case' of input when comparing


    I have a batch where i have to test a variable against a two letter user input and i need it to proceed regardless of the "Case" if the letter as long as they match
    if %var" = the input of aa or AA or even aA I need the comparison to ignore the 'case' of the letters, I thought this was done with a /I but I am to tired to look further and I must be doing it wrong. Past my bedtime

    Thanks
      My Computer


  2. Posts : 3,274
    Win10
       #2

    Something along the line of this test batch file ?

    Code:
    @ECHO enter aa or AA or any combination thereof
    @ECHO OFF
    @SET /p VAR=
    IF /I %VAR%==aa (
    ECHO  --------------This input works OK---------------------
    pause
    exit
    )
    ECHO  --------------This input doesn't work-----------------
    pause
    exit
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 18:10.
Find Us




Windows 10 Forums