How to determine if a variable is not & ldquo; space & quot;

advertisements

I'm making a new software where you have to register on it. I have the following code:

:LOOP
set CHO=?
set /p CHO=
if "%CHO%"=="?" goto LOOP
echo %CHO% > txt.txt
*more code*

So the problem here is that if the user decides to press space and enter, %CHO% is "ECHO is off.". This can be solved exporting the content from the text file into the program like this:

set /p CHO_PROBLEM=<txt.txt
if "%CHO_PROBLEM%"=="ECHO is off." goto BUG

But here comes the real problem, what if the system is in Spanish, French,...? (other lang than english). It says "ECHO is off." in the language... So, is it any way to solve that? I'm referring to JUST allow the user set his username if %CHO% is not equal to "?" or to "ECHO is off." (in all languages).


Here is a simple test; strips off space characters to test for single or multiple spaces.

:LOOP
set CHO=?
set /p CHO=
if "%CHO%"=="?" goto LOOP
if "%CHO: =%"=="" goto LOOP
echo %CHO% > txt.txt