Author Topic: Differentiating between windows 10 and 11  (Read 187 times)

em1

  • Newbie
  • *
  • Posts: 2
Differentiating between windows 10 and 11
« on: November 15, 2022, 02:08:07 am »
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

  • Sr. Member
  • ****
  • Posts: 407
Re: Differentiating between windows 10 and 11
« Reply #1 on: November 15, 2022, 05:16:40 am »
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

  • Tech Support
  • *****
  • Posts: 4208
    • WinBatch
Re: Differentiating between windows 10 and 11
« Reply #2 on: November 15, 2022, 05:41:35 am »
Use
Code: Winbatch
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

  • Newbie
  • *
  • Posts: 2
Re: Differentiating between windows 10 and 11
« Reply #3 on: November 15, 2022, 06:35:58 am »
thanks chuck and td, this is very helpful I will use the build number. :D