title: Wmic error handling in Batch script
body: <p>I am writing a Batch to uninstall a sofware from a domain envirement but stuck.
  The problem is that i need a return value to a variable of the wmic uninstall call but get nothing if its an RPC error,not even an errorlevel but i need it to separate the good and bad ones in a logfile.</p>
  
  <pre><code>setlocal enableextensions EnableDelayedExpansion
  @echo off
  set v=
  
  echo Nem voltak elerhetok &gt; nemelerheto.txt
  echo Hibakk &gt; log.txt
  echo. &gt;&gt;log.txt
  FOR /F "tokens=*" %%v in (runtime2k3.txt) do (
      IF Not !volt!==%%v (
          echo %%v &gt;&gt; log.txt
          echo %%v
          for /f %%p in ('ping -n 1 %%v ^| find /c "(0%% loss)"') do (
              if %%p==1 (
              echo elerheto
              echo elerheto &gt;&gt; log.txt
              wmic /output:wmic.txt /user:****** /password:"******" /node:%%v      product where name^="Microsoft Office Access 2003 Runtime" call uninstall  
  
  
  
              )
              if %%p==0 (
                  echo %%v &gt;&gt; nemelerheto.txt
                  echo nemelerheto &gt;&gt; log.txt
              )
          )   
      set array[!i!]=%%v
      set volt=%%v
  
      set /a i=!i!+1
  
  
      )
      echo. &gt;&gt; log.txt 
      )
  </code></pre>