I'm trying to make (hopefully a simple) script that when run pings my mobile device. If the mobile is connected to the network it will execute one command and if not it will execute another.
I've tried with the following command:
ping -n 1 (The IP) >nul IF ERRORLEVEL 0 GOTO safe IF ERRORLEVEL 1 GOTO alarm :safe start home.mp3 GOTO end :alarm start alarm.mp3 GOTO end :end exit
This actually worked once, but since then it doesn't work after the first ping. Is it something I'm missing? Perhaps there's an easier way of doing this?