title: Determining OS version via Scripting
body: <p>I found this script on another site but I can not get it to work and I don't know batch scripting that well</p>
  
  <pre><code>Set objWshShell = WScript.CreateObject("WScript.Shell")
  
  strOSVersion = objWshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
  
  If strOSVersion = "5.1" Then
      Debug.WriteLine("Windows XP")
      Rem Insert Windows XP Statements
  ElseIf strOSVersion = "6.0" Then
      Debug.WriteLine("Windows Vista")
      Rem Insert Windows Vista Statements
  ElseIf strOSVersion = "6.1" Then
      Debug.WriteLine("Windows 7")
      Rem Insert Windows 7 Statements
  End If
  </code></pre>
  
  <p>now if I run this I get the error on the second line </p>
  
  <pre><code>'strOSVersion' is not recognized as an internal or external command
  operable program or batch file.
  = was unexpected at this time.
  </code></pre>
  
  <p>I do not know why</p>