How do I convert the below code into CMD line code for windows?
r=`wget -q www.someurl.com`
if [ $r -ne 0 ]
  then echo "Not there"
  else echo "OK"
fi
How do I convert the below code into CMD line code for windows?
r=`wget -q www.someurl.com`
if [ $r -ne 0 ]
  then echo "Not there"
  else echo "OK"
fi
 
    
     
    
    something like this:
wget.exe -q www.someurl.com
if errorlevel 1 (
   echo not there
) ELSE (
    echo ok
)
the error can be printed with
    echo Failure  is %errorlevel%
 
    
    Using cmd's short-circuit && and || operators:
wget.exe -q www.someurl.com && (
  echo OK
) || (
  echo Not there
)
If the statements are short, you can make this into a one-liner
wget.exe -q www.someurl.com && ( echo OK ) || ( echo Not there )
This method only notes if the exit code is zero or nonzero.  If you need the actual exit code, use the if statements in Stuart Siegler's answer.
