KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using LEP to determine Windows OS version
PRODUCT: 4D | VERSION: 15 | PLATFORM: Win
Published On: November 17, 2015

Below is an utility method to determine the windows version by running 'ver' in the command prompt through launch external process. 'Ver' will return the build number associated with the OS.

//Method name: UTIL_GET_WIN_VER_LEP
//$0 - windows version

C_TEXT($in;$out;$err)
C_TEXT($0)

SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"true")
$in:=""
LAUNCH EXTERNAL PROCESS("cmd.exe /C ver";$in;$out;$err)
$0:=$out


This may be useful as PLATFORM PROPERTIES is currently not implemented to determine Windows 10 and future versions.

Example:
$ver:=UTIL_GET_WIN_VER_LEP

The result if ran from windows 7; will return something similar to: "Microsoft Windows [Version 6.1.7601]".

A list of windows version along with the build number can be viewed from the following article from Microsoft:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx