Get Install.wim info

The following .cmd script has not been fully tested but seems to work.

It allows the user to pick a particular wim index from a large install.wim Windows installation file

You can set a default index on timeout if the user does not respond (it sets different default depending on Windows version number.

If there are more than nine indexes then  CHOICE cannot be used, so we use set /P.

After the users choice, we get variables for Index number, full Version number, Windows version, Edition,  and architecture as well as full name (description).

Should work on .wim and .esd.

OS must support DISM + needed DLLs.

Here is the script running with a timeout (no user entry):

C:\temp>testwim.cmd

INDEX 1 = x64 10.0.17134 Windows 10 Home

INDEX 2 = x64 10.0.17134 Windows 10 Home N

INDEX 3 = x64 10.0.17134 Windows 10 Home Single Language

INDEX 4 = x64 10.0.17134 Windows 10 Education

INDEX 5 = x64 10.0.17134 Windows 10 Education N

INDEX 6 = x64 10.0.17134 Windows 10 Pro

INDEX 7 = x64 10.0.17134 Windows 10 Pro N


DEFAULT = 6

Enter Index Number (1-7) : 6


INDEX 6 = "Windows 10 Pro" "x64" "10.0.17134"

VER="10.0.17134"

WVER="10"

EDITION="PRO"

@echo off
set WIMFILE="G:\SOURCES\Windows10_2018_08_03_UK_Both\x64\sources\install.esd"REM Make sure WIMFILE string is in quotes in case has spaces in name
set CHOICE=set INDEX=1set INDEX_DEFAULT=:LOOPset DESC=for /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Descr"') do set DESC=%%afor /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Arch"') do set ARCH=%%afor /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Vers"') do set VER=%%aif NOT "%DESC%"=="" set DESC=%DESC:~1,200%if NOT "%DESC%"=="" set ARCH=%ARCH:~1,200%if NOT "%DESC%"=="" set VER=%VER:~1,200%if NOT "%DESC%"=="" echo INDEX %INDEX% = %ARCH% %VER% %DESC%if NOT "%DESC%"=="" set CHOICE=%CHOICE%%INDEX%if NOT "%DESC%"=="" set /A INDEX=%INDEX% + 1
REM get defaultfor /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Descr" ^| find /i "7 Ult"   ^| find /v /i " N" ^| find /v /i "Educ"') do set INDEX_DEFAULT=%INDEX%for /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Descr" ^| find /i "8.1 Pro" ^| find /v /i " N" ^| find /v /i "Educ"') do set INDEX_DEFAULT=%INDEX%for /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Descr" ^| find /i "10 Pro"  ^| find /v /i " N" ^| find /v /i "Educ"') do set INDEX_DEFAULT=%INDEX%for /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Descr" ^| find /i "11 Pro"  ^| find /v /i " N" ^| find /v /i "Educ"') do set INDEX_DEFAULT=%INDEX% 
if NOT "%DESC%"=="" goto :LOOPset /A INDEX=%INDEX%-1REM echo INDEXES 1-%INDEX% are usedREM echo CHOICES=%CHOICE%echo.
:GETINDEXREM USER ENTERS CHOICE HEREecho DEFAULT = %INDEX_DEFAULT%
set DEFAULT=1if NOT "%INDEX_DEFAULT%"=="" set DEFAULT=%INDEX_DEFAULT%set ASK=if %INDEX% LSS 10 CHOICE /N /T 10 /C %CHOICE% /D %DEFAULT% /M "Enter Index Number (1-%INDEX%) : "if %INDEX% LSS 10 set ASK=%ERRORLEVEL%if %INDEX% GTR 9 set /p ASK=Enter Index Number (1-%INDEX%) : if "%ASK%"=="" goto :GETINDEXset /A ASK=%ASK%+0 || goto :GETINDEXif %ASK%==0 goto :GETINDEXif %ASK% GTR %INDEX% goto :GETINDEXset INDEX=%ASK%REM echo %INDEX% chosenecho.
set VER=for /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Descr"') do set DESC=%%afor /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Arch"') do set ARCH=%%afor /f "tokens=2 delims=:" %%a in ('dism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX% ^| find /i "Vers"') do set VER=%%aif NOT "%DESC%"=="" set DESC=%DESC:~1,200%if NOT "%DESC%"=="" set ARCH=%ARCH:~1,200%if NOT "%DESC%"=="" set VER=%VER:~1,200%if NOT "%DESC%"=="" echo INDEX %INDEX% = "%DESC%" "%ARCH%" "%VER%"
REM set HOME in case core/home is not specified in descriptionset EDITION=HOMEdism /get-wiminfo /wimfile:%WIMFILE% /index:%INDEX%  | find /i "Descr" > t.txtfind /i "Pro" t.txt > nul && set EDITION=PROfind /i "Enter" t.txt > nul && set EDITION=ENTfind /i "Ultimate" t.txt > nul && set EDITION=ULTfind /i " S" t.txt > nul && set EDITION=Sfind /i "Home" t.txt > nul && set EDITION=HOMEfind /i "Core" t.txt > nul && set EDITION=HOMEfind /i "Home Single" t.txt > nul && set EDITION=HOMESfind /i "Education" t.txt > nul && set EDITION=EDUfind /i "Education N" t.txt > nul && set EDITION=EDUNfind /i "Pro Education" t.txt > nul && set EDITION=EDUPROfind /i "Pro Education N" t.txt > nul && set EDITION=EDUPRONfind /i "Pro N" t.txt > nul && set EDITION=PRONfind /i "Home N" t.txt > nul && set EDITION=HOMENfind /i "Core N" t.txt > nul && set EDITION=HOMENfind /i "Core Single" t.txt > nul && set EDITION=HOMESfind /i "Cloud" t.txt > nul && set EDITION=CLOUDfind /i "Cloud N" t.txt > nul && set EDITION=CLOUDNfind /i "Workstation" t.txt > nul && set EDITION=WORKfind /i "Workstation N" t.txt > nul && set EDITION=WORKNfind /i "Home Starter" t.txt > nul && set EDITION=HOMESTARTfind /i "Home Basic" t.txt > nul && set EDITION=HOMEBASICfind /i "Home Premium" t.txt > nul && set EDITION=HOMEPREMfind /i "Enterprise" t.txt > nul && set EDITION=ENTfind /i "Enterprise LTSC" t.txt > nul && set EDITION=ENTLTSC
set WVER=find /i "Windows 11" t.txt > nul && set WVER=11find /i "Windows 10" t.txt > nul && set WVER=10find /i "Windows 8" t.txt > nul && set WVER=8find /i "Windows 7" t.txt > nul && set WVER=7
echo VER="%VER%"echo WVER="%WVER%"echo EDITION="%EDITION%"