title: Trying to use curl in a bat file, getting curl errors 3 and 6. Think it has something to do with '^' but not sure how to fix?
body: <p>I'm using a bat file that  I didn't write, and supposedly all you have to do is put in a few pieces of info (api key, domain, &amp; responder ID) and it should work, the beginning of the file looks like this (I've obfuscated some stuff):</p>
  
  <blockquote>
  <pre><code>@echo off
  setlocal enabledelayedexpansion
  goto :main
  
  :main
  setlocal
  
      set domain=https://*****.*******.com
      set apiKey=9************XP
      set responderId=3*******8
  </code></pre>
  </blockquote>
  
  <p>The first time I tried executing the file from cmd I got an error, "Something went wrong while making the request, response_code is " with no actual response code. I did some digging and then ran <code>copy.bat any_optional_parameters &gt; copy.log</code> instead, and got some slightly more useful information:</p>
  
  <blockquote>
    <p>% Total    % Received % Xferd  Average Speed   Time    Time     Time
    Current
                                     Dload  Upload   Total   Spent    Left  Speed 100    40  100    40    0     0    134      0 --:--:-- --:--:--
    --:--:--   134   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed 100    40  100    40    0     0    111      0 --:--:-- --:--:--
    --:--:--   111 curl: (3) Host name '%http_code https' contains bad letter   % Total    % Received % Xferd  Average Speed   Time    Time<br>
    Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed   0     0    0     0    0     0      0      0 --:--:--  0:00:01
    --:--:--     0curl: (6) Could not resolve host: from   0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0curl: (6)
    Could not resolve host: number curl: (3) Port number ended with '"'<br>
    0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--
    0curl: (6) Could not resolve host: from   0     0    0     0    0<br>
    0      0      0 --:--:--  0:00:01 --:--:--     0curl: (6) Could not
    resolve host: number curl: (3) [globbing] unmatched close
    brace/bracket in column 123 curl: (3) Host name '%http_code https'
    contains bad letter</p>
  </blockquote>
  
  <p>I read <a href="https://stackoverflow.com/questions/50356524/call-curl-using-cmd">here</a> that the '^' character acts as an escape in bat files, but in that instance they were adding them, and didn't address what to do if one was in there by mistake (which is what I suspect in this case). I was able to find a couple of those carats in the bat file, like so:</p>
  
  <pre><code>for /f "tokens=*" %%g in ( 'curl -u !apiKey!:X -H "Content-Type: application/json" -X GET --write-out " %%{http_code}" !domain!/contacts.json?query^=phone+is+!num!' )
  </code></pre>
  
  <p>Is that maybe what's breaking this for me? If not, any other ideas? I did look up the curl errors but the explanations were somewhat generic for a noob like me. Thanks in advance for any pointers!</p>