title: how can i search for product in WMIC and if exist make a file
body: <p>I spend a lot of time to searching for the answer but still cannot solve the problem</p>
  
  <p><strong>Problem:</strong>
  I need to run batch file with fileName that will check on my pc if i have framework installed if yes it will make a fileName_1.txt with a framework version
  if not i will have empty fileName_0.txt</p>
  
  <p><strong>What i done until now:</strong></p>
  
  <pre><code>@echo off
  set pcName=%1
  for /f "tokens=1 delims=1" %%A in ('wmic product where "Name like '%%Microsoft .Net Framework 4.6%%'" get version') do set FrameworksVer=%%A
  
  IF "%frameworksVer%"=="No Instance(s) Available" (
  @echo Framework 4.6 Not exist &gt;&gt; c:\%pcName%_0.txt
  ) ELSE (
  @echo %FrameworksVer% &gt;&gt; c:\%pcName%_1.txt
  )
  </code></pre>
  
  <p>every loop in for assign everytime the variable</p>
  
  <p>the answer is always fileName_1.txt with couple echo on...</p>
  
  <p>how can i solve it?</p>
  
  <p>tnx.</p>