Batch nested If statement error with not defined variables
问题 I have a problem with a simple batch script. See: SET TEST= IF NOT DEFINED TEST ( SET "TEST=1" ) ELSE ( IF %TEST% LSS 1 ( SET "TEST=1") ) Here the if in the else branch failes, because the variable TEST ist not defined. But the else branch even shouldn't been executed if the variable TEST isn't defined!? What is here the problem? (I knew, that this code would work, if I leave the else and write it under the if statement, but then this code get's executed every time.) How to solve this problem