so what id like to have is a batch script that will act depending on the Windows 10 edition the user has. So right now I do have a basic script with a case
but it requires the user input. So I would like some help/tips on how to write that.
Thanks in advance
CodePudding user response:
As Windows 10 has WMIC.exe, here's a possible solution which may be of assistance to you:
@Echo Off
SetLocal EnableExtensions DisableDelayedExpansion
Set /A "SKU=OSV=0"
For /F "EOL=O Tokens=1,2 Delims=. " %%G In ('%SystemRoot%\System32\wbem\WMIC.exe
OS Where "Version>10" Get OperatingSystemSKU^, Version 2^>NUL'
) Do Set /A "SKU=%%G, OSV=%%H" 2>NUL
If Not %OSV% Equ 10 GoTo :EOF
For /F "Tokens=1,* Delims=:" %%G In ('%SystemRoot%\System32\findstr.exe
"^::%SKU%:" "%~f0"') Do Set "EDN=Windows %OSV% %%H"
Echo %