0

我有一个用于安装 Windows 的批处理文件。它为您提供一系列菜单以导航到最终的 WIM 映像编号。然后它使用 imagex 将图像应用到指定的驱动器号。我想让菜单动态,所以它只显示基于 WIM 文件中的条目。我目前有一个 WIM 文件,其中包含从 vista 到 server 2012 的每个版本的 windows。我想去掉一些图像,这样它就更精简了,但我不想重建安装程序,因为它是一个痛苦的屁股. 我想要一些帮助

我想到但我不知道如何实现的一件事是它读取图像名称并在其受人尊敬的位置为其制作菜单。

如何使菜单动态化?

有关任何其他提示或提示,请访问

https://github.com/elliot-labs/WinInstaller

这是当前的安装批处理文件:

:start
@echo off
cls
cd /d %~dp0

rem Sets up the working directory.




goto Menu





:Menu
cls
set selection=
cls
echo 1. Windows Server
echo 2. Windows Client
set /p selection=Please chose which OS type you want [1 or 2]:
if %selection% EQU 1 goto Server
if %selection% EQU 2 goto Client


:Server
cls
set selection=
echo 1. Server 2008 (x86)
echo 2. Server 2012 (x64)
set /p selection=Please chose which OS you want [1 or 2]:
if %selection% EQU 1 goto 2008
if %selection% EQU 2 goto 2012


:Client
cls
set selection=
echo 1. Windows 8
echo 2. Windows 7
echo 3. Windows Vista
set /p selection=Please chose which OS you want [1, 2 or 3]:
if %selection% EQU 1 goto 8
if %selection% EQU 2 goto 7
if %selection% EQU 3 goto Vista



:2008
cls
set selection=
echo 1. Server Standard
echo 2. Server Enterprise
echo 3. Server Data Center
echo 4. Server Standard Core (no GUI)
echo 5. Server Enterprise Core (no GUI)
echo 6. Server Data Center (no GUI)
set /p selection=Please chose which OS type you want [1-6]:
if %selection% EQU 1 goto i19
if %selection% EQU 2 goto i18
if %selection% EQU 3 goto i17
if %selection% EQU 4 goto i16
if %selection% EQU 5 goto i15
if %selection% EQU 6 goto i14

:2012
cls
set selection=
echo All are 64 bit (x64)
echo 1. Server Standard Core (no GUI)
echo 2. Server Standard
echo 3. Server Data Center Core (no GUI)
echo 4. Server Data Center
set /p selection=Please chose which OS type you want [1-4]:
if %selection% EQU 1 goto i23
if %selection% EQU 2 goto i22
if %selection% EQU 3 goto i21
if %selection% EQU 4 goto i20



:8
cls
set selection=
echo 1. Windows 8 x86
echo 2. Windows 8 Pro x86
echo 3. Windows 8 x64
echo 4. Windows 8 Pro x64
set /p selection=Please chose which OS type you want [1-4]:
if %selection% EQU 1 goto i10
if %selection% EQU 2 goto i11
if %selection% EQU 3 goto i12
if %selection% EQU 4 goto i13


:7
cls
set selection=
echo 1. Windows 7 Starter x86
echo 2. Windows 7 Home Basic x86
echo 3. Windows 7 Home Premium x86
echo 4. Windows 7 Professional x86
echo 5. Windows 7 Ultimate x86
echo 6. Windows 7 Home Basic x64
echo 7. Windows 7 Home Premium x64
echo 8. Windows 7 Professional x64
echo 9. Windows 7 Ultimate x64
set /p selection=Please chose which OS type you want [1-9]:
if %selection% EQU 1 goto i5
if %selection% EQU 2 goto i4
if %selection% EQU 3 goto i3
if %selection% EQU 4 goto i2
if %selection% EQU 5 goto i1
if %selection% EQU 6 goto i9
if %selection% EQU 7 goto i8
if %selection% EQU 8 goto i7
if %selection% EQU 9 goto i6

:Vista
cls
set selection=
echo 1.  Windows Vista Starter x86
echo 2.  Windows Vista Business N x86
echo 3.  Windows Vista Home Basic N x86
echo 4.  Windows Vista Ultimate x86
echo 5.  Windows Vista Home Premium x86
echo 6.  Windows Vista Home Basic x86
echo 7.  Windows Vista Business x86
echo 8.  Windows Vista Ultiamte x64
echo 9.  Windows Vista Home Premium x64
echo 10. Windows Vista Home Basic x64
echo 11. Windows Vista Vista Business x64
set /p selection=Please chose which OS type you want [1-11]:
if %selection% EQU 1 goto i24
if %selection% EQU 2 goto i25
if %selection% EQU 3 goto i26
if %selection% EQU 4 goto i27
if %selection% EQU 5 goto i28
if %selection% EQU 6 goto i29
if %selection% EQU 7 goto i30
if %selection% EQU 8 goto i31
if %selection% EQU 9 goto i32
if %selection% EQU 10 goto i33
if %selection% EQU 11 goto i34




:i1
set index=1
goto dest
:i2
set index=2
goto dest
:i3
set index=3
goto dest
:i4
set index=4
goto dest
:i5
set index=5
goto dest
:i6
set index=6
goto dest
:i7
set index=7
goto dest
:i8
set index=8
goto dest
:i9
set index=9
goto dest
:i10
set index=10
goto dest
:i11
set index=11
goto dest
:i12
set index=12
goto dest
:i13
set index=13
goto dest
:i14
set index=14
goto dest
:i15
set index=15
goto dest
:i16
set index=16
goto dest
:i17
set index=17
goto dest
:i18
set index=18
goto dest
:i19
set index=19
goto dest
:i20
set index=20
goto dest
:i21
set index=21
goto dest
:i22
set index=22
goto dest
:i23
set index=23
goto dest
:i24
set index=24
goto dest
:i25
set index=25
goto dest
:i26
set index=26
goto dest
:i27
set index=27
goto dest
:i28
set index=28
goto dest
:i29
set index=29
goto dest
:i30
set index=30
goto dest
:i31
set index=31
goto dest
:i32
set index=32
goto dest
:i33
set index=33
goto dest
:i34
set index=34
goto dest



:install
imagex /apply Y:\WIMs\install.wim %index% %dest%:
pause
goto Boot




:dest
cls
echo Please enter the drive letter you want to install to.
set /p dest=Please chose which letter you want [A-Z]:
goto install




:Boot
cls
echo This will run EasyBCD from which you can install the Boot loader.
pause
Y:\Programs\EasyBCD\EasyBCD.exe
cls
echo Instalation complete!
pause

Windows 7 SP1 x86 install dvd install.wim 的 imagex 输出:

ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Version: 6.1.7600.16385

WIM Information:
----------------
Path:        B:\install.wim
GUID:        {03825cb3-3e7f-4798-81f4-9ca6ef277819}
Image Count: 5
Compression: LZX
Part Number: 1/1
Attributes:  0xc
             Integrity info
             Relative path junction


Available Image Choices:
------------------------
<WIM>
  <TOTALBYTES>2249000978</TOTALBYTES>
  <IMAGE INDEX="1">
    <DIRCOUNT>9107</DIRCOUNT>
    <FILECOUNT>46905</FILECOUNT>
    <TOTALBYTES>8074968070</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8901</HIGHPART>
      <LOWPART>0xEF63352E</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8BC</HIGHPART>
      <LOWPART>0xBB84D710</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>0</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>Starter</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 STARTER</NAME>
    <DESCRIPTION>Windows 7 STARTER</DESCRIPTION>
    <FLAGS>Starter</FLAGS>
    <HARDLINKBYTES>3037806302</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Starter</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Starter</DISPLAYDESCRIPTION>
  </IMAGE>
  <IMAGE INDEX="2">
    <DIRCOUNT>9140</DIRCOUNT>
    <FILECOUNT>47108</FILECOUNT>
    <TOTALBYTES>8127590116</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8901</HIGHPART>
      <LOWPART>0xEF63352E</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8BC</HIGHPART>
      <LOWPART>0xD91B65FA</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>0</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>HomeBasic</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 HOMEBASIC</NAME>
    <DESCRIPTION>Windows 7 HOMEBASIC</DESCRIPTION>
    <FLAGS>HomeBasic</FLAGS>
    <HARDLINKBYTES>3069177344</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Home Basic</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Home Basic</DISPLAYDESCRIPTION>
  </IMAGE>
  <IMAGE INDEX="3">
    <DIRCOUNT>9357</DIRCOUNT>
    <FILECOUNT>48117</FILECOUNT>
    <TOTALBYTES>8569006173</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8901</HIGHPART>
      <LOWPART>0xEF63352E</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8BC</HIGHPART>
      <LOWPART>0xF5B79DFA</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>0</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>HomePremium</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 HOMEPREMIUM</NAME>
    <DESCRIPTION>Windows 7 HOMEPREMIUM</DESCRIPTION>
    <FLAGS>HomePremium</FLAGS>
    <HARDLINKBYTES>3448347246</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Home Premium</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Home Premium</DISPLAYDESCRIPTION>
  </IMAGE>
  <IMAGE INDEX="4">
    <DIRCOUNT>9414</DIRCOUNT>
    <FILECOUNT>48560</FILECOUNT>
    <TOTALBYTES>8450188760</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8901</HIGHPART>
      <LOWPART>0xEF63352E</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8BD</HIGHPART>
      <LOWPART>0x0FC1CCF2</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>0</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>Professional</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 PROFESSIONAL</NAME>
    <DESCRIPTION>Windows 7 PROFESSIONAL</DESCRIPTION>
    <FLAGS>Professional</FLAGS>
    <HARDLINKBYTES>3314667745</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Professional</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Professional</DISPLAYDESCRIPTION>
  </IMAGE>
  <IMAGE INDEX="5">
    <DIRCOUNT>9450</DIRCOUNT>
    <FILECOUNT>48736</FILECOUNT>
    <TOTALBYTES>8610128720</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8901</HIGHPART>
      <LOWPART>0xEF63352E</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8BD</HIGHPART>
      <LOWPART>0x20960638</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>0</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>Ultimate</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 ULTIMATE</NAME>
    <DESCRIPTION>Windows 7 ULTIMATE</DESCRIPTION>
    <FLAGS>Ultimate</FLAGS>
    <HARDLINKBYTES>3473147759</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Ultimate</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Ultimate</DISPLAYDESCRIPTION>
  </IMAGE>
</WIM>

以下是 Windows 7 SP1 x64 WIM 上的相同命令 (imagex /info)

B:\AIO>imagex /info B:\install.wim

ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Version: 6.1.7600.16385

WIM Information:
----------------
Path:        B:\install.wim
GUID:        {65caf905-5e50-4a42-900b-5e14084871e9}
Image Count: 4
Compression: LZX
Part Number: 1/1
Attributes:  0xc
             Integrity info
             Relative path junction


Available Image Choices:
------------------------
<WIM>
  <TOTALBYTES>2954387497</TOTALBYTES>
  <IMAGE INDEX="1">
    <DIRCOUNT>13365</DIRCOUNT>
    <FILECOUNT>64285</FILECOUNT>
    <TOTALBYTES>11710161360</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8936</HIGHPART>
      <LOWPART>0x131F339A</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8F0</HIGHPART>
      <LOWPART>0x0027D0DC</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>9</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>HomeBasic</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 HOMEBASIC</NAME>
    <DESCRIPTION>Windows 7 HOMEBASIC</DESCRIPTION>
    <FLAGS>HomeBasic</FLAGS>
    <HARDLINKBYTES>4497873056</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Home Basic</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Home Basic</DISPLAYDESCRIPTION>
  </IMAGE>
  <IMAGE INDEX="2">
    <DIRCOUNT>13614</DIRCOUNT>
    <FILECOUNT>65339</FILECOUNT>
    <TOTALBYTES>12222587449</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8936</HIGHPART>
      <LOWPART>0x131F339A</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8F0</HIGHPART>
      <LOWPART>0x236D21C7</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>9</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>HomePremium</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 HOMEPREMIUM</NAME>
    <DESCRIPTION>Windows 7 HOMEPREMIUM</DESCRIPTION>
    <FLAGS>HomePremium</FLAGS>
    <HARDLINKBYTES>4912986404</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Home Premium</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Home Premium</DISPLAYDESCRIPTION>
  </IMAGE>
  <IMAGE INDEX="3">
    <DIRCOUNT>13701</DIRCOUNT>
    <FILECOUNT>65851</FILECOUNT>
    <TOTALBYTES>12122886417</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8936</HIGHPART>
      <LOWPART>0x131F339A</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8F0</HIGHPART>
      <LOWPART>0x47C4A445</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>9</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>Professional</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 PROFESSIONAL</NAME>
    <DESCRIPTION>Windows 7 PROFESSIONAL</DESCRIPTION>
    <FLAGS>Professional</FLAGS>
    <HARDLINKBYTES>4786527097</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Professional</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Professional</DISPLAYDESCRIPTION>
  </IMAGE>
  <IMAGE INDEX="4">
    <DIRCOUNT>13737</DIRCOUNT>
    <FILECOUNT>66029</FILECOUNT>
    <TOTALBYTES>12285492779</TOTALBYTES>
    <CREATIONTIME>
      <HIGHPART>0x01CB8936</HIGHPART>
      <LOWPART>0x131F339A</LOWPART>
    </CREATIONTIME>
    <LASTMODIFICATIONTIME>
      <HIGHPART>0x01CBF8F0</HIGHPART>
      <LOWPART>0x6D7F6938</LOWPART>
    </LASTMODIFICATIONTIME>
    <WINDOWS>
      <ARCH>9</ARCH>
      <PRODUCTNAME>Microsoftr Windowsr Operating System</PRODUCTNAME>
      <EDITIONID>Ultimate</EDITIONID>
      <INSTALLATIONTYPE>Client</INSTALLATIONTYPE>
      <HAL>acpiapic</HAL>
      <PRODUCTTYPE>WinNT</PRODUCTTYPE>
      <PRODUCTSUITE>Terminal Server</PRODUCTSUITE>
      <LANGUAGES>
        <LANGUAGE>en-US</LANGUAGE>
        <DEFAULT>en-US</DEFAULT>
      </LANGUAGES>
      <VERSION>
        <MAJOR>6</MAJOR>
        <MINOR>1</MINOR>
        <BUILD>7601</BUILD>
        <SPBUILD>17514</SPBUILD>
        <SPLEVEL>1</SPLEVEL>
      </VERSION>
      <SYSTEMROOT>WINDOWS</SYSTEMROOT>
    </WINDOWS>
    <NAME>Windows 7 ULTIMATE</NAME>
    <DESCRIPTION>Windows 7 ULTIMATE</DESCRIPTION>
    <FLAGS>Ultimate</FLAGS>
    <HARDLINKBYTES>4947144081</HARDLINKBYTES>
    <DISPLAYNAME>Windows 7 Ultimate</DISPLAYNAME>
    <DISPLAYDESCRIPTION>Windows 7 Ultimate</DISPLAYDESCRIPTION>
  </IMAGE>
</WIM>

Imagex 来自 Microsoft 官方的 Windows 7“自动安装工具包”

4

2 回答 2

1

你的问题启发了我...

@ECHO OFF
REM Below section is not to be executed, is just database, so it is commented.
REM It is beginning with "REM D;" because batch code will scan itself
REM and identify "REM D" as database entries (as well as "REM DE" as database end).
REM Database entries (format "REM D";Title;(m)enu/(d)isk;target;parent)
REM D;Windows Client;m;Client
REM D;Windows Server;m;Server
REM D;Server Data Center (no GUI);d;14;2008
REM D;Server Enterprise Core (no GUI);d;15;2008
REM D;Server Standard Core (no GUI);d;16;2008
REM D;Server Data Center;d;17;2008
REM D;Server Enterprise;d;18;2008
REM D;Server Standard;d;19;2008
REM D;Server Data Center;d;20;2012
REM D;Server Data Center Core (no GUI);d;21;2012
REM D;Server Standard;d;22;2012
REM D;Server Standard Core (no GUI);d;23;2012
REM D;Windows 7 Ultimate x86;d;1;7
REM D;Windows 7 Professional x86;d;2;7
REM D;Windows 7 Home Premium x86;d;3;7
REM D;Windows 7 Home Basic x86;d;4;7
REM D;Windows 7 Starter x86;d;5;7
REM D;Windows 7 Ultimate x64;d;6;7
REM D;Windows 7 Professional x64;d;7;7
REM D;Windows 7 Home Premium x64;d;8;7
REM D;Windows 7 Home Basic x64;d;9;7
REM D;Windows 8 x86;d;10;8
REM D;Windows 8 Pro x86;d;11;8
REM D;Windows 8 x64;d;12;8
REM D;Windows 8 Pro x64;d;13;8
REM D;Windows 7;m;7;Client
REM D;Windows 8;m;8;Client
REM D;Windows Vista;m;Vista;Client
REM D;Server 2008 (x86);m;2008;Server
REM D;Server 2012 (x64);m;2012;Server
REM DE;This is (D)ata (E)nd, used to stop iterations

REM SETLOCAL used to enable delayed expansion, so !Index! may be used.
SETLOCAL ENABLEDELAYEDEXPANSION
CALL :Menu
IF NOT DEFINED Disk GOTO :EOF
REM From here, %Disk% contains desired disk number.
ECHO %Disk% & PAUSE
SET /P "Drive=Enter drive letter [A-Z]: "
imagex /apply Y:\WIMs\install.wim %Disk% %Drive%:
PAUSE
CLS
ECHO This will install EasyBCD from which you can install the Bootloader.
PAUSE
Y:\Programs\EasyBCD\EasyBCD.exe
CLS
ECHO Instalation complete!
PAUSE
GOTO :EOF

REM :Menu shows options based on parent level and ask user.
REM Note that first database entries have not parent data
:Menu [%1=Parent]
SET Disk=
CALL :ShowMenu %1

:MenuPrompt
ECHO.
SET /P "Index=Option: "
SET /A Index*=1
IF %Index% GTR 0 IF %Index% LEQ %Count% (
    FOR /F "TOKENS=1-5 DELIMS=;" %%i IN (%~fs0) DO IF /I "%%i"=="REM D" IF /I "%%m"=="%1" (
        SET /A Index-=1
        IF !Index!==0 (
            echo %%k
            IF /I "%%k"=="m" CALL :Menu %%l & GOTO :EOF
            IF /I "%%k"=="d" SET "Disk=%%l"& GOTO :EOF
            ECHO Database broken: m or d expected!1>&2
            GOTO :EOF
        )
    )
    GOTO :EOF
)
ECHO Invalid option!
GOTO :MenuPrompt

:ShowMenu [%1=Parent]
CLS
SET Count=0
FOR /F "TOKENS=1-5 DELIMS=;" %%i IN (%~fs0) DO (
    IF /I "%%i"=="REM D" IF /I "%%m"=="%1" (
        SET /A Count+=1
        ECHO [!Count!] %%j
    ) ELSE IF /I "%%i"=="REM DE" GOTO :EOF
)
GOTO :EOF
于 2013-09-13T14:44:09.640 回答
0

我到处看了看……我终于把批处理文件变成了一个动态系统。

这是代码:

:start
@echo off
cls
cd /d %~dp0
goto setwiminfo

rem Sets up the working directory. (Inportant to do this)

:setwiminfo
cls
echo Please enter the full path to the
set /p WIM=WIM file of your choice:
cls
echo Path set.
pause
imagex /info "%WIM%" | find "<NAME>" >> Images.txt
goto dest

rem Sets where the WIM is located and also makes the list of images avalable in the wim.

:dest
cls
echo Where would you like to install the image?
set /p dest=Enter the drive letter here [A-Z]:
goto index

rem This sets the destination that the image is to be applied to. (Cool tip: you can apply to a directory E.G. X:\dir\)
rem The cool tip is usually used for devolapement.

:index
echo :start >> Display.bat
echo @echo off >> Display.bat
echo cls >> Display.bat
echo cd /d "%~dp0" >> Display.bat
echo echo List of images avalable for instalation: >> Display.bat
echo echo *Note the image number on the left of the name* >> Display.bat
echo find /N "<NAME>" Images.txt >> Display.bat
echo pause >> Display.bat
echo del Images.txt >> Display.bat
echo exit >> Display.bat
start Display.bat
cls
set /p index=Please inter the number of the image (name) you want to install:
goto install 

rem This makes another batch file that displays the index information in a new window.

:install
echo this will install the wim to the destination you selected.
pause
cls
imagex /apply "%WIM%" %index% "%dest%":
goto boot

rem Applies the image to the selected drive (or folder if you chose).

:boot
echo EasyBCD is starting from which you can install the boot loader.
Y:\Programs\EasyBCD\EasyBCD.exe
pause
goto cleanup

rem This runs EasyBCD because I havn't integrated bcdboot commands yet... (coming soon)

:cleanup
del Display.bat
del Images.txt
goto choice

rem This cleans up files created by the script.

:choice
cls
echo do you want to install another image?
choice
if %ERRORLEVEL% EQU 1 goto start
if %ERRORLEVEL% EQU 2 goto end
echo Error please try again :(
pause
goto choice

rem This loops the script if the user want's to apply another image.

:end
cls
echo Thank you for using Elliot Labs installer!
echo For feature requests please email elliot-labs@live.com
echo Thank you!
pause | echo Press any key to exit...
exit
于 2013-09-24T14:42:03.993 回答