title: curl with output in file and the output file name has a variable
body: <p>I want to create a folder if it's not exist. 
  After that i want to get a file from a url with login and password.</p>
  
  <p>But by my example curl don't used the variable in the output.</p>
  
  <p>How can i create the variable for using it in the output ? What is the right syntax ?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>SET TS=%TIME: =0%
  SET DS=%DATE: =0%
  SET path=%CD%
  SET logfile=%path%\%DS:~6,4%_%DS:~3,2%_%DS:~0,2%\%TS:~0,2%%TS:~3,2%%TS:~6,2%_example.gz
  
  if not exist %path%\%DS:~6,4%_%DS:~3,2%_%DS:~0,2% mkdir %DS:~6,4%_%DS:~3,2%_%DS:~0,2%
  
  curl -u loginname:pw http://example.url.com/example.gz &gt; @%logfile%</code></pre>
  </div>
  </div>
  </p>