title: Escaping Double Quotes in Batch Script
body: <p>How would I go about replacing all of the double quotes in my batch file's parameters with escaped double quotes? This is my current batch file, which expands all of its command line parameters inside the string:</p>
  
  <pre><code>@echo off
  call bash --verbose -c "g++-linux-4.1 %*"
  </code></pre>
  
  <p>It then uses that string to make a call to Cygwin's bash, executing a Linux cross-compiler. Unfortunately, I'm getting parameters like these passed in to my batch file:</p>
  
  <pre><code>"launch-linux-g++.bat" -ftemplate-depth-128 -O3 -finline-functions 
  -Wno-inline -Wall  -DNDEBUG   -c 
  -o "C:\Users\Me\Documents\Testing\SparseLib\bin\Win32\LinuxRelease\hello.o" 
  "c:\Users\Me\Documents\Testing\SparseLib\SparseLib\hello.cpp"
  </code></pre>
  
  <p>Where the first quote around the first path passed in is prematurely ending the string being passed to GCC, and passing the rest of the parameters directly to bash (which fails spectacularly.)</p>
  
  <p>I imagine if I can concatenate the parameters into a single string then escape the quotes it should work fine, but I'm having difficulty determining how to do this. Does anyone know?</p>