In practical system administration, it is sometimes necessary to record edition and/or version of Windows along with the product key (for example, before installing a non-Windows OS with the view of using the Windows product key on a different machine). This can be accomplished by using systeminfo and piping its output to findstr:
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
This will output the requested data fields in a format similar to this:
OS Name: Microsoft Windows 10 Home OS Version: 10.0.14393 N/A Build 14393
To display Windows 8.1 or Windows 10 product key, use wmic:
wmic path softwarelicensingservice get OA3xOriginalProductKey
Needless to say, all of the above has to be done while running the command line interpreter with administrative privileges.