Not a direct answer to the question, but if you encounter this message in any program, batch command, etc. then it's most likely related to your PATH containing characters. For instance, in Atom editor I was getting the message in the settings view. \ GNU was unexpected at this time windows batch else was unexpected at this time And at that time, param1 has no value making the if statements invalid. When using delayed expansion, the variables are only expanded when the command is actually called. Also I recommend using if not defined command to determine if a variable is set.
Why does my if Else if statement not work in Batch script? \csmilmset p dbchoice 1 ELSE was unexpected at this time. E: \csmilm) ELSE ( E: \csmilm What is the problem here? windows batchfile. windows batch file does not know anything about integers. try if dbchoice equ 1 Adrien Plisson Oct 10 '11 at 9: 27. windows batch else was unexpected at this time
because of parentheses special meaning in batch scripting, all opening (and closing ) are escaped in all occurrences where those should be used literally (echo and set p). Trying if 11 (echo (inner) parentheses) will show that it could matter. I am getting was unexpected at this time. while using the below for loop for some cases only. for f tokens1, delims; m in (file. txt) do ( echo Inside Loop echo m ) I'm calling this batch file from another batch file in a loop. So every time, the content of the file. txt to My code is in a batch file. The error: enter your age: 22 50 was unexpected at this time. @echo off set p age enter your age: if age leq 50 ( if age geq 20 ( echo You are age years old in the 21st century. ) else ( echo You are not in range. ) else ( echo You are not in range. ) pause windows batch else was unexpected at this time Please take a look a the following problem and subsequent solution here: . was unexpected at this time generated from batch script line 'if exist [file ( The solution was simply the treatment of '(' and ')' on ECHO lines inside an IF statement block. Apr 15, 2012 To the best I can, I couldn't tell why the problem is even debugging it in CMD. It says 0 was unexpected at this time. I couldn't figure out why the variable skip was processed at the first time even the log. log file does not exist at that time. f was unexpected at this time. I have taken all advice but to no avail. i think i may have possibly done something else wrong, or maybe this isnt possible on my system: If you typed bash code but put it in a file called something. bat then when you run it it will be run as a windows batch It's more than this solution. Get answers and train to solve all your tech problems anytime, anywhere. Try it for free Edge Out The Competition for your dream job with proven skills and certifications. Get started today Stand Out as the employee with proven skills. Start learning today for free Move Your Career Forward with certification training in the latest technologies.