title: Processing Semicolon on Command line
body: <p>I have two batch files which is used to run a large C++ build, the first one starts the processes, creating directories and figuring out what to send to the second script. If certain information is presented to the first script, I have a routine that pops up a window and asks for a password. This is passed to the second script by calling the second script like this </p>
  
  <pre><code>call script2.bat -pw:myPassword
  </code></pre>
  
  <p>where myPassword is something the user entered. 
  now, i have been testing this script and one of my users password contains a semicolon, so we get this</p>
  
  <pre><code>call script2.bat -pw:my;Password
  </code></pre>
  
  <p>I found by putting in quotes I can get this into the second script OK</p>
  
  <pre><code>call script2.bat -pw:"my;Password"
  </code></pre>
  
  <p>However, the command line parsing breaks when I try to do this</p>
  
  <pre><code>for /F "tokens=1,2 delims=:" %%a in ( "%1" ) DO SET switch=%%a&amp;value=%%b
  </code></pre>
  
  <p>if I <code>echo %1</code> it shows like this</p>
  
  <pre><code>-pw:"my;Password"
  </code></pre>
  
  <p>But with echo on when the script runs I see</p>
  
  <pre><code>for /F "tokens=1,2 delims=:" %%a in ( "-pw:"my Password"" ) DO SET switch=%%a&amp;value=%%b
  </code></pre>
  
  <p>and it parses as <code>switch=-pw</code> and <code>value="my</code></p>
  
  <p>What I eventually need is for value to contain my;Password so I can pass it to another program</p>
  
  <p>Any ideas on how to get this to parse correctly</p>
  
  <p>Here  re 2 batch file that issulstrate the problem:</p>
  
  <p>a.bat:</p>
  
  <pre><code>echo on
  
  call b.bat -pw:eatme
  call b.bat -pw:eat;me
  call b.bat -pw:"eat;me"
  call "b.bat -pw:\"eat;me\""
  </code></pre>
  
  <p>b.bat:</p>
  
  <pre><code>echo on
  
  echo %1
  
  for /F "tokens=1,2 delims=: " %%a in ( "%1" ) DO SET switch=%%a&amp;SET value=%%b 
  
  echo switch=%switch% 
  echo value=%value%
  </code></pre>