title: How execute a command in batch-file if errorlevel is not zero?
body: <p>I created a simple batch file which would enable me to connect to the internet.<br>
  I made it this way- If the connection is successful a message is displayed stating "connection successful" using VBscript and display a message stating "connection failure" if the connection is not established. I made this using if-else statements and errorlevel command, but I am not able to display the failure message using 'errorlevel == 1' command.I mean that if there was an error in the connection process the success message is displayed instead of failure message.</p>
  
  <p>Here's the code in my batch file.</p>
  
  <pre><code>rasdial "TATA PHOTON+" internet
  
  @echo off
  if ERRORLEVEL == 0 (echo MSGBOX "Connection successfully established to TATA PHOTON+" &gt; %temp%\TEMPmessage.vbs
  call %temp%\TEMPmessage.vbs
  del %temp%\TEMPmessage.vbs /f /q)
  else if ERRORLEVEL == 1 (echo MSGBOX "ERROR: Unable to establish connection" &gt; %temp%\TEMPmessage.vbs
  call %temp%\TEMPmessage.vbs
  del %temp%\TEMPmessage.vbs /f /q
  )
  </code></pre>