batch replace command, i'm confused : <p>okay, so I tried this</p>

<pre><code>set x=12 &amp;
set var=(x)
set var=%var:(=^%%
set var=%var:)=^%%
echo %var%
</code></pre>

<p>and I get x%%</p>

<p>then I did this</p>

<pre><code>setlocal enabledelayedexpansion

set var=!var:(=%!

set var=!var:)=%!

echo %var%
</code></pre>

<p>and I get !var:)=%!</p>

<p>both methods failed, so I need help.</p>
