I am trying to test if a string is uppercase. I know that this works:
@echo off
setlocal enabledelayedexpansion
set X=A
set Y=a
echo !X!|findstr "^[ABCDEFGHIJKLMNOPQRSTUVWXYZ]*$"
echo !errorlevel!
echo !Y!|findstr "^[ABCDEFGHIJKLMNOPQRSTUVWXYZ]*$"
echo !errorlevel!
and this results with an errorlevel
of 1 if it isn't uppercase, but I would like to find out if it is uppercase without the echo
portion, like using an if
statement. But I don't know how to use the findstr
and pass it a variable to test, so that it can result with an errorlevel
I can test in an if
statement.