title: Why errorlevel is still 0
body: <p>I am trying to query each instance on my CMS. But why the errorlevel is still 0 when I tested the stopped instance? And how can I skip the last line in my Instance_list.txt (The %%a will be '(44')</p>
  
  <pre><code>:Start
  REM get the full list of our instance from CMS to Instance_list.txt
  "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd" -S cms_instance -e -d msdb -Q "SELECT DISTINCT server_name FROM sysmanagement_shared_registered_servers_internal" -o Instance_list.txt 
  :Run
  REM Run query against all instances one by one.
  @echo off
  setlocal enabledelayedexpansion
  for /f "tokens=1,2 skip=3" %%a in (Instance_list.txt) do (
  Set Intance_NAME=%%a
  
  "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd" -S !Intance_NAME! -e -d master -Q "SELECT @@SERVERNAME" -o SQL_result.txt
  TIMEOUT /T 2
  FINDSTR "!Intance_NAME!" SQL_result.txt
  IF %ERRORLEVEL% NEQ 0 (
  ECHO SQL INSTANCE !Intance_NAME! HAS SOME ISSUE...
  )
  )
  </code></pre>