|
Answer» Hi all could someone please help me with this, i'm trying to get this .cmd to work, we used to have it working years ago this is the part that's giving me problems:
:checksvr for /F "skip= 2 tokens= 2" %%i in ('ping -n 1 %1') do ( if not %%i == timed (set STATE=%%i) else ( for /F "skip= 2 tokens= 2" %%k in ('ping -n 1 %1') do (set STATE=%%k) ) ) for /F "delims== tokens=2" %%j in ('set status_%2') do ( if not '%%j' == '%STATE%' ( set status_%2=%STATE% if %STATE% == timed (goto :svr_crashed) else ( if %%j == timed ((now %2 RUNNING again) & (logevent -s i "%2 up again")) ) ) else ( if %STATE% == from (now %2 running ok) else ( if %STATE% == timed (now %2 STILL crashed) ) ) )
i get a (goto was UNEXPECTED at this time error.
thanks guyssurround both sides of IF TESTS in quote marks
if "%%i"=="timed"
and take out spaces
|