I\'m using the batch script below and get an error
( was unexpected at this time.
I know that the problem is in the first line but
I had a very similar problem and code construct that was causing me a lot of pain to resolve. My error message was ". was unexpected at this time"...
It took me a couple long days to figure out another similar consideration due to this problem... 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.
The point is, do consider treatment of special characters as a possible source of a problem when troubleshooting IF (and possibly FOR) statements.
HTH someone...