String substitution in batch file name expansion
<p>Is there a trick to doing string substitution on the variables like <code>"%~dp0"</code>?  I have been creating intermediate variables, then substituting, but was wondering if there was a way to cut out the intermediary?  For example, here I would like to replace <code>\</code> with <code>/</code> in the path</p>

<pre><code>@echo off
setlocal
pushd "%~dp0"

:: doesn't work
echo."%~dp0:\=/"

:: with intermediate 'v'
set "v=%~dp0"
echo."%v:\=/%"

popd
</code></pre>

<p>I tried various combinations of quotes and <code>%</code>, but have just been taking shots in the dark.</p>