If you want to query the Windows OS version from a batch file or from a program then you can Windows registry. Windows Registry stores all the details like OS name, Service pack number, Version name etc. It also points to the source location from where the OS is installed. All this data is stored in the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion.
The above registry key has the following registry values.
SubVersionNumber REG_SZ
CurrentBuild REG_SZ 1.511.1 () (Obsolete data - do not use)
InstallDate REG_DWORD 0x4c69e464
ProductName REG_SZ Microsoft Windows XP
RegDone REG_SZ
RegisteredOrganization REG_SZ
RegisteredOwner REG_SZ
SoftwareType REG_SZ SYSTEM
CurrentVersion REG_SZ 5.1
CurrentBuildNumber REG_SZ 2600
BuildLab REG_SZ 2600.xpsp_sp2_qfe.080814-1242
CurrentType REG_SZ Multiprocessor Free
CSDVersion REG_SZ Service Pack 2
SystemRoot REG_SZ C:WINDOWS
SourcePath REG_SZ D:i386
PathName REG_SZ C:WINDOWS
ProductId REG_SZ XXXX-XXX-XXXX-XXXXXI have highlighted the ones that can be useful. OS name can be queried from ProductName registry value.
CSDVersion tells us the service pack number.
In the case of Windows 7, which Registry value will tell be whether the system is 32- or 64-bit (WoW64)?
thanks