WinVersion determines version data of the current Windows system and returns selected data values. These values are returned with the program's exit code, in order to support their utilization within command files or scripts.
WinVersion can also display a complete version information.
Data output can be specified via WinVersion's call parameter, which can be one of the following:
|-base||version class (see the following table),
e.g. 109 = Windows 8.1 64-bit
|-bitness||1 = 32-bit, 2 = 64-bit|
|-info||displays version information (exit code 1)|
|-product||product type value (see the description below)|
|-type||1 = Workstation, 2 = Domain Controller, 3 = Server|
|-version||major and minor version numbers combined,
such as 63 = "6.3" = Windows 8.1 (see the following table)
WinVersion provides two different version numberings. For the argument -base, a numeration of the Windows version classes is returned. In many cases, this is the most important and sufficient information. 64-bitness adds 100 to this value.
With the argument -version you get the combination of major and minor version numbers, which are the actual values.
|Windows Version||Exit Code (-base)
64-bit OS: +100
|Exit Code (-version)|
|Windows XP||5||51 (64-bit: 52)|
The product type values returned by argument -product are the type codes of the API function GetProductInfo, which is availlable from Windows 6 (Vista/Server 2008) on. The large number of possible values is listed in the function description. Following are some typical values:
|System||Product Type / Exit Code|
|Pro with Media Center||103|
The exit code 0 principally signals a failure, especially version data not received. This value could also be returned as a product type for an "unknown product" (PRODUCT_UNDEFINED).
WinVersion is primarily intended to give the opportunity to differentiate between Windows versions within automated processes, for example to run version-specific programs (such as driver installation).
In a command file (.bat or .cmd), you can check the exit code using the IF ERRORLEVEL statement or the %ERRORLEVEL% variable.
winversion.exe -base if errorlevel 100 (echo 64 Bit) winversion.exe -version if %errorlevel% EQU 63 (echo Windows 8.1)
In a WSH script, the exit code can be evaluated using the Exec and Run methods of the WScript.Shell object.
Dim ws, ec Set ws = WScript.CreateObject("WScript.Shell") ec = ws.Run("winversion.exe -base", , True) WScript.Echo "Exit code = " & ec
For further information consult the descriptions available on these topics, in particular the MS documentation "Windows Command Reference" and "Microsoft Windows Script Technologies".
Notice a peculiarity that exists in Windows Vista. The console process may permanently bind an external drive, for example a USB stick, if it was started from this drive. As a result, the system later refuses to release the drive again. This is a systemic error that can occur with any application.
You can avoid the problem by not using the console ("Command Prompt"). WinVersion is not a console program and can also be used in a script.
WinVersion is provided as freeware and "as is" without any warranty or liability. Please note that any usage of WinVersion is at your own risk.
WinVersion has been tested on different Systems from Windows 11 downwards to Windows XP. The program will probably not run on older systems (Windows 2000 and earlier).
WinVersion is available as an executable program file winversion.exe. Download this file and save it to a folder of your choice. The program doesn't require installation and has no external dependencies.