Until Windows 10 version 2004 (May 2020) this can be found from registry entry ReleaseID, after that we must use entry DisplayVersion (ReleaseId is stuck at 2009). Source: https://ss64.com/nt/ver.html