Substring of a variable in batch
<p>I have a variable defined in a batch file as follows</p>

<pre><code>set "SERVERNAME=VKR\SQL2012"
</code></pre>

<p>I need to extract VKR from this. Is there a way I could do this?</p>

<p>I tried this </p>

<pre><code>set "value=%SERVERNAME:*\=%"
echo %value%
</code></pre>

<p>which returned SQL2012 but not VKR</p>