WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: em1 on November 15, 2022, 02:08:07 AM

Title: Differentiating between windows 10 and 11
Post by: em1 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.
Title: Re: Differentiating between windows 10 and 11
Post by: ChuckC 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.
Title: Re: Differentiating between windows 10 and 11
Post by: td on November 15, 2022, 05:41:35 AM
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.
Title: Re: Differentiating between windows 10 and 11
Post by: em1 on November 15, 2022, 06:35:58 AM
thanks chuck and td, this is very helpful I will use the build number. :D