Differentiating between windows 10 and 11

Started by em1, November 15, 2022, 02:08:07 AM

Previous topic - Next topic

em1

Hi, does anyone here know how to tell the difference between windows 10 and 11 using Winbatch?

I'm trying to determine if the person running the script is using windows 11 so I can exit the script, anything other than this is acceptable. I've been attempting this with WinVersion(level) and from the help pages on WinBatch/my own tests I can see that when searching for major version windows 10 and 11 are lumped together. I would like to find a way to differentiate between the two. I'm running WinBatch version 2022D.

I have been advised not to use build number as with each different version of Windows you can have the same build number and I've tried using the ReleaseID as it seemed like a reliable way to differentiate however with a computer running Windows 10 it returned "2009" which I was only expecting to happen with Windows 11.

Thanks.

ChuckC

For both Windows 10 and Windows 11, the major version is "10".

The difference is in the build number.  For Windows 11, the build number starts at 22000 and goes up.  Windows 10 has a build number in the 19xxx range that will never reach 22000.

td

Use
Code (winbatch) Select
BuildNum = WinVersion(2) to obtain the Windows build number.  The latest build number for Windows 11 22H2 is 22621. As Chuck pointed out any build number greater than or equal to 22000 is at least Windows 11.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

em1

thanks chuck and td, this is very helpful I will use the build number. :D