set server=192.168.10.1 :wait ping -n 1 %server%|find "TTL=" > nul if %errorlevel%==1 goto wait %SystemRoot%\system32\mstsc.exe /v %server% exit