title: Batch Parameters workaround to avoid %
body: <p>I have a batch script which uses command line arguments to perform a task; however, "%2" is also included in a URL, thus the url also gets the second command line argument pasted where %2 should be. How could I avoid this scenario while maintaining the command line arguments? One solution would be to store the command line arguments as a variable then destroy the original %2, but I am unsure of how to achieve this.</p>
  
  <p>Would this be a case of setlocal and endlocal? If so, how could I destroy the command line arguments once I save them as variable names? I could also turn-off the command line arguments once I store them. Any ideas on how to do this?</p>
  
  <p>I have been directed to this Stack Overflow question <a href="https://stackoverflow.com/questions/10218451/how-can-i-url-encode-spaces-in-an-nt-batch-file">How can I URL-encode spaces in an NT batch file?</a>; however, I am unsure if this is what I am looking for. It seems in this question, the OP was wanting to include the URL in the batch parameter call. I am wanting my batch parameter calls to remain %1 = username, %2 = password, %3 = fullname and then reference them in the script without them being pasted in the URL within the script. I am accessing the URL's via wget and "%20" is being used as a space. Thus, where ever %2 is, it is pasting my the password parameter rather than keeping it "%2". I know this Stack Overflow question is the right direction, but I cannot formulate a solution from it. Any tips or help? </p>
  
  <p>Code Example:</p>
  
  <pre><code>foo.bat foobar passwordforfoobar foobarfullname
  </code></pre>
  
  <p>Within batch script </p>
  
  <pre><code>call wget.exe --keep-session-cookies --save-cookies="cookies.txt" --post-data="username=%1&amp;password=%2" "www.foo.com"
  
  call wget.exe --load-cookies=cookies.txt "www.foo.com/search=2017%20Foo%20test"
  </code></pre>