Boost C++ Libraries: Ticket #13085: Bad command line escaping for Windows shell https://svn.boost.org/trac10/ticket/13085 <p> I'm trying to launch a command with the windows shell: </p> <div class="wiki-code"><div class="code"><pre>call <span class="s2">&quot;%VS140COMNTOOLS%\vsvars32.bat&quot;</span> </pre></div></div><p> so the source is: (i have to escape the double-quotes and antislash) </p> <div class="wiki-code"><div class="code"><pre><span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">getCommandLine</span><span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;call </span><span class="se">\&quot;</span><span class="s">%VS140COMNTOOLS%</span><span class="se">\\</span><span class="s">vsvars32.bat</span><span class="se">\&quot;</span><span class="s">&quot;</span> <span class="p">}</span> <span class="n">bp</span><span class="o">::</span><span class="n">child</span> <span class="n">child</span><span class="p">(</span><span class="n">getCommandLine</span><span class="p">(),</span> <span class="n">bp</span><span class="o">::</span><span class="n">shell</span><span class="p">);</span> </pre></div></div><p> The problem is that Boost is double-escaping the double-quotes, and the windows shell does not understand that: </p> <pre class="wiki">Error: '\"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\\vsvars32.bat\"' is not recognized as an internal or external command, operable program or batch file. The problem resides here : boost/process/detail/windows/basic_cmd.hpp :35 :48 :72 I just had to comment these lines to fix the command line and spawn the shell with the correct args. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13085 Trac 1.4.3 Salamandar <felix@…> Tue, 20 Jun 2017 08:58:01 GMT <link>https://svn.boost.org/trac10/ticket/13085#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13085#comment:1</guid> <description> <p> EDIT: </p> <ul><li>I *need* the double-quotes because the string contains spaces. </li><li>sorry for the bad formatting, but I can't edit the issue now. </li><li>the lines contents are : <ul><li><code> boost::replace_all(st, "\"", "\\\""); </code> </li><li><code> boost::replace_all(arg, "\"", "\\\""); </code> </li><li><code> boost::replace_all(arg, L"\"", L"\\\""); </code> </li></ul></li></ul> </description> <category>Ticket</category> </item> </channel> </rss>