Hi, I wish a menu showing Index and Name in a same line. Could you please help? Thanks. Code: @ECHO OFF SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION pushd "%~dp0" :menuLOOP echo. echo.= Menu ================================================= echo. DISM /Get-ImageInfo /ImageFile:d:\wimboot.wim | findstr /i "Index Name" set choice= echo.&set /p choice=Input an Index number and hit ENTER to install: ||goto:menuLOOP echo.&call:CHOICE pause :CHOICE echo Index %choice% is starting to be installed ... exit /b output Code: = Menu ================================================= Index : 1 Name : Windows 8.1 Pro Index : 2 Name : Windows 8.1 Enterprise Input an Index number and hit ENTER to install: 1 Index 1 is starting to be installed ... Press any key to continue . . . Better Code: = Menu ================================================= 1: Windows 8.1 Pro 2: Windows 8.1 Enterprise Input a number and hit ENTER to install: 1 Index 1 is starting to be installed ... Press any key to continue . . . Best Code: = Menu ================================================= 1: Windows 8.1 Pro 2: Windows 8.1 Enterprise Input a number and hit ENTER to install: 1 Windows 8.1 Pro is starting to be installed ... Press any key to continue . . . Two Variables: One for Index, the other for Name.
Code: @ECHO OFF SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION pushd "%~dp0" :menuLOOP echo. echo.= Menu ================================================= echo. for /f "tokens=2 delims=: " %%a in ('dism /English /Get-WimInfo /WimFile:"d:\wimboot.wim" ^| findstr /i Index') do ( for /f "tokens=2 delims=:" %%g in ('dism /English /Get-WimInfo /WimFile:"d:\wimboot.wim" /Index:%%a ^| findstr /i Name') do ( echo %%a : %%g ) ) set choice= echo.&set /p choice=Input an Index number and hit ENTER to install: ||goto:menuLOOP echo.&call:CHOICE pause :CHOICE echo Index %choice% is starting to be installed ... exit /b You can also set them to variables during the loop .
Thank you. But it flashed away. And I tried this to no avail Code: SET Images-Num= SET LoopNum= SET I= FOR /F "TOKENS=3 Delims=: " %%a in ('imagex /INFO d:\wimboot.wim ^| imagex /INFO d:\wimboot.wim | Findstr /C:"Image Count"') do set Images-Num=%%a SET /a LoopNum=%Images-Num% + 1 @Echo Index Image Name :LOOP1 SET /a I=%I% + 1 IF "%I%"=="%LoopNum%" goto END FOR /F "TOKENS=3 Delims=>,<" %%a in ('Imagex /INFO d:\wimboot.wim %I% ^| findstr /C:"<NAME>"') do @Echo [%I%] %%a pause goto LOOP1 :END pause Code: Imagex /INFO d:\wimboot.wim 1 | findstr /C:"<NAME>" Code: <NAME>Windows 8.1 Pro</NAME> I can do N command for N images. Code: 1: Pro 2: Ent 3: . . . :1 bla bla ... exit /b :2 bla bla ... exit /b . . . :END What If there were 100 images? 100 commands? NO! If success, no need to guess how many images in a WIM. And it's gonna be kinda easy to deal with AIO with one command. Code: 1. pro 2. ent 3. . . . :ONE COMMAND FOR ALL INSTALL THE %INDEX% user specified from what detected. exit /b
My bad, forgot the ending ')', should be: Code: @ECHO OFF SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION pushd "%~dp0" :menuLOOP echo. echo.= Menu ================================================= echo. for /f "tokens=2 delims=: " %%a in ('dism /English /Get-WimInfo /WimFile:"d:\wimboot.wim" ^| findstr /i Index') do ( for /f "tokens=2 delims=:" %%g in ('dism /English /Get-WimInfo /WimFile:"d:\wimboot.wim" /Index:%%a ^| findstr /i Name') do ( echo %%a : %%g ) ) set choice= echo.&set /p choice=Input an Index number and hit ENTER to install: ||goto:menuLOOP echo.&call:CHOICE pause :CHOICE echo Index %choice% is starting to be installed ... exit /b
Bad news, Slave77 When applied to startnet.cmd Code: @echo off FOR %%a IN ( C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z: ) DO @if exist %%a\bootmgr.efi set Drv=%%a %Drv% diskpart /S %Drv%\DiskpartFiles\disk-wimboot.txt :Credits to Slave77 SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION :menuLOOP echo. echo.= Menu ================================================= echo. for /f "tokens=2 delims=:" %%a in ('dism /Get-WimInfo /WimFile:%Drv%\image\wimboot.wim ^| findstr /i Index') do ( for /f "tokens=2 delims=:" %%g in ('dism /Get-WimInfo /WimFile:%Drv%\image\wimboot.wim /Index:%%a ^| findstr /i Name') do ( echo %%a : %%g ) ) set choice= echo.&set /p choice=Input an Index number and hit ENTER to install: ||goto:menuLOOP Code: = Menu ================================================= Input an Index number and hit ENTER to install: Note: It did not matter with /English, because I wanted it to be Global. Edit: This way worked. Code: :Credits to Slave77 :menuLOOP cls echo. echo.= Menu ================================================= echo. for /f "tokens=2 delims=: " %%a in ('"dism /Get-WimInfo /WimFile:%Drv%\image\wimboot.wim | findstr /i Index"') do ( for /f "tokens=2 delims=:" %%b in ('"dism /Get-WimInfo /WimFile:%Drv%\image\wimboot.wim /Index:%%a | findstr /i Name"') do ( set NAME=%%b&echo %%a : %%b ) ) set INDEX= echo.&set /p INDEX=Input a number and hit ENTER to install: ||goto:menuLOOP Code: = Menu ================================================= 1 : Windows 8.1 Pro 2 : Windows 8.1 Enterprise Input a number and hit ENTER to install: Thank you.