jeudi 17 novembre 2016

BATCH - netstat command in IF statement

I have a problem with my code ..

SET con = netstat -a -n | find "127.0.0.1:3306"
if "%con%" == "" (
    telnet 127.0.0.1 3306
)
pause

Whenever I execute this command it runs the telnet command.

Actually when I look manually for netstat -a -n | find "127.0.0.1:3306" it isn't equal to "" but %con% is always set to "", why?.

What I am doing wrong?

Aucun commentaire:

Enregistrer un commentaire