Saved Bookmarks
| 1. |
Solve : Weird Batch File Behaviour.? |
|
Answer» Ok, this is an extract of some code I have been writing. It's purpose is to check if there are characters ENTERED, ie not blank or any number of spaces. I tried using `findstr /r "[^a-z,0-9]"` for characters and using || if no characters were found but I couldn't get it to work. Anyway, this really has me CONFUSED... @echo off Now as you can see, the echoed string variable, (which if blank or spaces should return "ECHO is off."), is piped to the findstr command. Which with case-insensitivity and searching for the phrase "ECHO is on." (Does not work with off). Now you'd assume that entering no or only blank characters would make this return nothing, as the string "ECHO is off." should have been found as 'echo' is the same as 'echo '. Quote ECHO is off. Of course if you type "ECHO is on." as the input it is found. Though why is findstr finding echo is on, on blank entries when echo is clearly off? |
|