0

Updated question

Winver gives you the Windows 10 full version number: Version + Build + "SubBuild", e.g. 1909 (Build 18363.1556) as GUI a window.

I found the ver command which gives the full build number as a CLI output but not the version number or the code name. All other usual CLI suspects like systeminfo etc. don't give you version number either.

Is there a command that will give you the version number (preferably as well as the code name) as a CLI output?

I'm interested in CMD as well as PowerShell. The thing I prefer is a easy to remember command.


Old question (just for reference)

Winver gives you the Windows 10 code name as well as the Windows full version number (Version + Build + "SubBuild") as GUI a window. I found the ver command which gives the full version number as a CLI output but not the code name (code name is called DisplayVersion in the registry since 20H1). All other usual suspects like systeminfo etc. give you a more or less complete version number or the ReleaseId but they don't give you code name either.

Is there a command that give you the code name as a CLI output. I'm interested in CMD as well as PowerShell. The thing I prefer is a easy to remember command.

Note: I checked the answers of the supposed duplicate question, I didn't find any answer which gives you the code name, plz let me know if I overlook it.

Note: The registry holds the code name DisplayVersion-value under the HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion-key. But it gets created only after an update has been made (even if was a minor update did not change the version number).

Note: I just realized, the version number becomes the code name since 20H2.

Albin
  • 9,307
  • 11
  • 50
  • 89
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/132331/discussion-on-question-by-albin-get-the-windows-10-code-name-e-g-21h2-via-cli). – DavidPostill Dec 14 '21 at 20:12
  • @Ramhound ReleaseID will not give you the codename, but version number. CodeName is 21H2, version number is 2109. Not the same thing I'm afraid. – LPChip Dec 14 '21 at 20:29
  • @Ramhound yes, they changed it since 20H2. I run 20H2 and my ReleaseID is 2009. – LPChip Dec 14 '21 at 20:32
  • I've updated my answer based on our conversation that has been moved to chat. – LPChip Dec 14 '21 at 20:35
  • "But it gets created only after an update" - This is only half true. `DisplayVersion` only gets created once you have installed 20H2+ on the machine, since the key does not exist before that version, `ReleaseId` is used instead. The answer reflects the reality of the situation today and yesterday though, so other then my OCD that can't stand partially incorrect information, I will leave it be. – Ramhound Dec 14 '21 at 21:30

1 Answers1

3

This answer was edited after the discussion in the comments. It seems that if you upgrade from a previous install, the following powershell command will work:

(Get-Item "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue('DisplayVersion')

This will query the register key and display its result as text without any object.

In my case, that will display:

20H2

If this doesn't work, then this key is not in your registry, which seems to be the case for a fresh install, but it seems that doing at least one Windows Update run with reboot creates that registry key.

See below what I have in my registry:

enter image description here

Do note, that this is something that changed since version 20H2 and newer. Before that, the codename was equal to the ReleaseId, so if DisplayVersion returns nothing, also check the following command:

(Get-Item "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion").GetValue('ReleaseId')

LPChip
  • 59,229
  • 10
  • 98
  • 140
  • Great answer for updated systems, that solves at least part of my problem, on machines that are updated, thanks +1 (but still looking for an answer on all machines). Thanks for all the help so far! – Albin Dec 14 '21 at 19:52
  • @Albin - You have to specify details about "all systems", otherwise, [here](https://superuser.com/questions/1519110/how-to-get-the-actual-version-number-for-windows-10-from-command-line-not-buil/1519122#1519122) is a great duplicate candidate. – Ramhound Dec 14 '21 at 20:26
  • @Ramhound see our lengthy comments exchange. ReleaseId is not what we're after. We're looking for DisplayVersion. – LPChip Dec 14 '21 at 20:28
  • @LPChip - `DisplayVersion` does not exist before 20H1 based on the fact it does not exist for 1909. However, the information should be in the question body, not a chatroom. – Ramhound Dec 14 '21 at 20:33
  • @Ramhound yes, but OP is looking for the codename that was introduced since 20H2. So you are correct, that it was non-existent before. – LPChip Dec 14 '21 at 20:34
  • @LPChip - Their other machines are running 1909. So for those machines the question I linked to would be applicable. – Ramhound Dec 14 '21 at 20:36
  • @Ramhound I've updated my answer to clarify, because yes, in that case ReleaseId is the right value. :) – LPChip Dec 14 '21 at 20:39
  • @Ramhound, your links answers does not provide the code name as it is stated in the winver GUI-tool... unless I overlook s.th.. Not sure what I should include in my question, could you elaborate? – Albin Dec 14 '21 at 20:54
  • @Albin - The duplicate I linked to works for 1909. I guarantee you that is the case. Microsoft change the key with the release of 20H2 from `ReleaseId` to `DisplayVersion`, Microsoft stopped using (1903,1909, 2004) with the release of the 20H2 (i.e. what would have been called 2009 but wasn't). But I don't know what versions you have deployed, so I won't be spending more time on this question, until your question is clearly defined. The only two elements of a feature update is the DisplayVersion/ReleaseVersion and the build number. **"Code name" isn't a thing.** – Ramhound Dec 14 '21 at 20:57
  • @Ramhound it's called "code name" in Wikipedia, e.g. 1909 is 19H2 (see link in my question), what's the correct name for the 19H2 then? I have all Win 10 versions deployed as long they are not completely EOL. What do you need me to specify? Could you please elaborate? PS. 2009 is being used (as the release ID) – Albin Dec 14 '21 at 21:04
  • @Ramhound 1909 is the oldest version 21H2 the news version which are still (in part) not EOL. I have both of them as a testsystem (and several of the in between versions, do you need me to tell you all of them?) – Albin Dec 14 '21 at 21:15
  • "What's the correct name for the 19H2 then?" - `Windows 10 version 1909`. Microsoft didn't transition to the XXHYY format until 20H2 was released. Every version before that was the YYMM format. Wikipedia can call it anything they want, does not mean, the community editors are correct. "Redstone" and "Threshold" were codenames, but neither of them, was actually used outside of the Insider Preview program. Microsoft only used Version, or the build of the specific build, to refer to a specific build of Windows 10. – Ramhound Dec 14 '21 at 21:21
  • this whole version/build/code name was quite confusing, I hope I sorted it out, please see update to the question – Albin Dec 14 '21 at 22:00