Here's one possible way, using WMIC
:
@Echo Off
Set "VN="
For /F "EOL=V Tokens=*" %%A In (
'WMIC OS Where "Version<'4'" Get Version 2^>Nul'
) Do For /F "Tokens=3 Delims=." %%B In ("%%A") Do Set "VN=%%B"
If Not Defined VN Exit /B
If %VN% GEq 11082 If %VN% LEq 16299 Set "VN="
If Defined VN Exit /B
Rem your install code goes here.
Notes:
There were three preview releases of Threshold 1
which are not covered by my WMIC
code: 6.4.9841
, 6.4.9860
and 6.4.9879
The first release covered by my first 6
lines is the preview version of Threshold 1
released on January 23 2015, 10.0.9926
; every other release since should work up to that point!
The following releases are covered by my answer:
- Redstone 1 Preview Releases:
10.0.11082
December 16 2015 up to 10.0.14390
July 15 2016
- Redstone 1 Public Releases:
10.0.14393
From July 18 2016
- Redstone 2 Preview Releases:
10.0.14901
August 11 2016 up to 10.0.15061
March 17 2017
- Redstone 2 Public Releases:
10.0.15063
From March 20 2017
- Redstone 3 Preview Releases:
10.0.16170
April 7 2017 up to 10.0.16296
September 22 2017
- Redstone 3 Public Releases:
10.0.16299
From September 26 2017
Edit
This code is added for the purposes of an additional OP requirement in the comment section.
@Echo Off
Set "VN="
For /F "EOL=V Tokens=*" %%A In (
'WMIC OS Where "Version<'4'" Get Version 2^>Nul'
) Do For /F "Tokens=3 Delims=." %%B In ("%%A") Do Set "VN=%%B"
If Not Defined VN Exit /B
If %VN% GEq 11082 If %VN% LEq 16299 Set "VN="
If Defined VN GoTo SkipInstall
Rem your install code goes here.
Exit /B
:SkipInstall
Rem your code for Threshold or Redstone 4 goes here.