BATCH - netstat command in IF statement
<pre><code>SET con = netstat -a -n | find &quot;127.0.0.1:3306&quot;
if &quot;%con%&quot; == &quot;&quot; (
    telnet 127.0.0.1 3306
)
pause
</code></pre>
<p>This will always execute telnet.</p>
<p>Actually when I look manually for <code>netstat -a -n | find &quot;127.0.0.1:3306&quot;</code> it isn't equal to <code>&quot;&quot;</code> but <code>%con%</code> is always set to <code>&quot;&quot;</code>, why?.</p>
<p>What I am doing wrong?</p>