<p>I want to store a URL prefix in an Windows environment variable. The ampersands in the query string makes this troublesome though.</p>

<p>For example: I have a URL prefix of <code>http://example.com?foo=1&amp;bar=</code> and want to create a full URL by providing a value for the <code>bar</code> parameter. I then want to launch that URL using the "start" command.</p>

<p>Adding quotes around the value for the SET operation is easy enough:</p>

<pre><code>set myvar="http://example.com?foo=1&amp;bar="
</code></pre>

<p>Windows includes the quotes in the actual value though (thanks Windows!):</p>

<pre><code>echo %myvar%
"http://example.com?foo=1&amp;bar=true"
</code></pre>

<p>I know that I can strip quotes away from batch file arguments by using tilde:</p>

<pre><code>echo %~1
</code></pre>

<p>However, I can't seem to do it to named variables:</p>

<pre><code>echo %~myvar%
%~myvar%
</code></pre>

<p>What's the syntax for accomplishing this?</p>

I think this should do it:
```
```
for /f "tokens=*" %i in (%myvar%) do set %myvar%=%~i
```
```
But you do not need this,
```
```
set myvar="http://example.com?foo=1&bar="
start "" %myvar%
```
```
Will work too, you just need to supply a title to the start command.