title: batch file to check if Python is installed
body: <p>I've written a batch script that checks if Python is installed, if it's not installed - it initiates the Python installer contained in the same folder as itself.</p>
  
  <p>I'm using the following code:</p>
  
  <pre><code>reg query "hkcu\software\Python 2.6"
  
  if ERRORLEVEL 1 GOTO NOPYTHON 
  
  :NOPYTHON
  ActivePython-2.6.4.8-win32-x86.msi
  
  reg query "hklm\SOFTWARE\ActiveState\ActivePerl\" 1&gt;&gt;Output_%date%_%time%.log 2&gt;&amp;1
  if ERRORLEVEL 1 GOTO NOPERL 
  
  reg query "hklm\SOFTWARE\Gtk+"
  if ERRORLEVEL 1 GOTO NOPYGTK 
  
  
  :NOPERL
  ActivePerl-5.10.1.1006-MSWin32-x86-291086.msi 1&gt;&gt;Output_%date%_%time%.log 2&gt;&amp;1
  
  :NOPYGTK
  pygtk_windows_installer.exe
  </code></pre>
  
  <p>But in some cases the installer starts up even if Python is installed. What is the problem here?</p>