title: Batch file to compare versions of MSI file and Installed version
body: <p>I have an install script currently that only installs if the product isn't already installed (by checking for the presence of the app's EXE), but I'd like to take it a step further and have it only install if the MSI version is newer than the installed version. And although it would be nice for the script to query the MSI for this, if this isn't possible, I could always update the MSI version in a variable within the script...but it would be nice if it was active query that didn't need to be always updated.</p>
  
  <p>I haven't been able to find anything that can get me the MSI version, and the only place I've seen the MSI version is when I do look at File Properties -> Details -> Subject line: Product XYZ 10.2.3.</p>
  
  <p>For checking the installed version, I've found: </p>
  
  <pre><code>wmic datafile where name='c:\\windows\\system32\\notepad.exe' get version
  </code></pre>
  
  <p>Which returns two lines, second of which is 10,2,3 (using comma's instead of decimals).</p>
  
  <p>If I use:</p>
  
  <pre><code>wmic product where "name like 'Product XYZ%%'" get version
  </code></pre>
  
  <p>I get the same result but in the expected decimal format, but the query takes MUCH longer to run. But in either case, I still need to figure out how to actually work off the queried result.</p>
  
  <p>This might be easier with a VBS, which I'm ok with, as long as I can call it within my existing batch file as well as work off the VBS result within my batch file.</p>
  
  <p>Thanks in advance!
  Brian</p>