Batch file: <part of command line> was unexpected at this time
batch-file
Solution
- for-variables have one-char-variables (%A instead of %AA)
- you missed a space between IN and (
- in a batch-file you have to double the percent-signs for the for-variable (%%A instead of %A)
Problem
Trying to execute a command inside a batch file and drop the result into a variable. Here's what I would execute interactively: ``` curl -d "username=someUser" http://someServer/trusted ``` The result is a 15-20 character alpha-numeric string. Here's my attempt at doing same in a batch file: ``` FOR /f %AA IN('curl -d \"username=someUser\" http://someServer/trusted') DO ECHO %AA ``` Error returned is: ``` //someServer/Trusted') was unexpected at this time ``` I thought I was dealing with some sort of escaping issue, so I added the \ symbols in front of my quotes. From what I've read, the : symobol in http doesn't need to be escaped, but it's interesting to me that's where the failure appears to "start". Any ideas on this? I'm on Win8.1, FYI