title: Escaping the and (&) sign in Powershell
body: <p>I need to use <code>\r\n</code> inside of <code>ffmpeg --header</code> parameter. This works in Unix, but not in Windows command prompt. So I was wondering to use <code>powershell</code> </p>
  
  <pre><code>powershell c:\ffmpeg -headers 'User-Agent: user-agent'"`r`n"'Cookies: my-cookie' ...
  </code></pre>
  
  <p>I understand I have to use <code>'string'</code> when special characters are used and </p>
  
  <pre><code>"`r`n"
  </code></pre>
  
  <p>as my <code>\r\n</code> delimiter. </p>
  
  <p>I have also tested that I can mix them together, like <code>'this '"is "'text'</code> to get <code>this is text</code></p>
  
  <p>However if my string (cookie or user-agent) contains <code>&amp;</code> character, it fails.</p>
  
  <p>Example: <code>powershell c:\ffmpeg -headers 'Cookies: param=a=1&amp;b=2; session=123'</code> </p>
  
  <p>How can I "escape" <code>&amp;</code> character in one-liner?</p>
  
  <hr>
  
  <p>These examples (some parts are masked) are accepted by CMD, but they are not working</p>
  
  <pre><code>powershell -c "c:\ffplay -user_agent ""Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0"" -headers ""Cookie: nlqptid=h=676886edeea5bae904b0cf53daec8038.1519940538670&amp;hdnea=exp=1519940598~acl=/*~hmac=C0E019502B060D23AB02BB157FCFFC72404500770A2CE5B00789A84AAEFBD77F&amp;nltid=xxxxxxxxxx&amp;nltdt=0&amp;uid=744826&amp;csid=xxxxxxxxxx; hdntl=exp=1520026938~acl=%2f*~hmac=952689e6de57a2a201ddc1d4c0794962fdc886ea48cf41494a42e787ef923bf9`r`n"" -i ""https://xxxxxxxxxx.net/nlds_vod/xxxxxxxxxx/vod/2018/02/28/cd264e10-dd54-3de2-df90-4c1cac104dcb/v1/stream/cd264e10-dd54-3de2-df90-4c1cac104dcb_1_4500_pc.mp4.m3u8"""
  </code></pre>
  
  <p>or</p>
  
  <pre><code>powershell -c "c:\ffplay -headers ""User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0`r`nCookie: nlqptid=h=676886edeea5bae904b0cf53daec8038.1519940538670&amp;hdnea=exp=1519940598~acl=/*~hmac=C0E019502B060D23AB02BB157FCFFC72404500770A2CE5B00789A84AAEFBD77F&amp;nltid=xxxxxxxxxx&amp;nltdt=0&amp;uid=744826&amp;csid=xxxxxxxxxx; hdntl=exp=1520026938~acl=%2f*~hmac=952689e6de57a2a201ddc1d4c0794962fdc886ea48cf41494a42e787ef923bf9`r`n"" -i ""https://xxxxxxxxxx.net/nlds_vod/xxxxxxxxxx/vod/2018/02/28/cd264e10-dd54-3de2-df90-4c1cac104dcb/v1/stream/cd264e10-dd54-3de2-df90-4c1cac104dcb_1_4500_pc.mp4.m3u8"""
  </code></pre>
  
  <p><code>ffplay</code> says</p>
  
  <blockquote>
    <p>An input file must be specified</p>
  </blockquote>
  
  <p>But the input file is specified after <code>-i</code> parameter.</p>
  
  <p>What is wrong with this command?</p>
  
  <hr>
  
  <p><em>Note that the implementation is a part of the existing batch script, therefore it is required to use a syntax working inside of batch file.</em></p>