尝试添加 HTA 和脚本包,它确实会增加 boot.wim 的大小,但某些库需要依赖项。还要检查您是否也添加了相应的语言包。我第一次在 WinPE 中创建 .Net 应用程序时使用的策略是添加所有包并在 Virtual Box 中对其进行测试,然后慢慢删除我不需要查看它是否有效的包。我制作了一个批处理脚本来添加所有包并 REM 删除我不需要的包。如果需要,这是脚本
Dism /Mount-Image /ImageFile:"Z:\Tools\winpe_x86\media\sources\boot.wim" /index:1 /MountDir:"Z:\Tools\winpe_x86\mount"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -HTA.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-HTA_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -WMI.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-WMI_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -MDAC.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-MDAC_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -GamingPeripherals.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -Dot3Svc.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-Dot3Svc_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -PPPoE.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-PPPoE_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -RNDIS.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-RNDIS_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -WDS-Tools.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation环境\x86\WinPE_OCs\en-us\WinPE-WDS-Tools_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -Scripting.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -NetFx.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-NetFx_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -PowerShell.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-PowerShell_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -DismCmdlets.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-DismCmdlets_en-us.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -SecureBootCmdlets.cab"
Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs\WinPE -StorageWMI.cab" Dism /Add-Package /Image:"Z:\Tools\winpe_x86\mount" /PackagePath:"C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Preinstallation Environment\ x86\WinPE_OCs\en-us\WinPE-StorageWMI_en-us.cab" Dism /Unmount-Image /MountDir:"Z:\Tools\winpe_x86\mount" /commit
要在虚拟机中测试使用 VMI 作为驱动器,Windows 7 及更高版本可以使用 Diskpart 或磁盘管理挂载 VMI 文件。