我需要在 Windows 10(Home/Pro x64 1909)上安装 Windows 的离线功能,如“LegacyCompoents”、“DirectPlay”、“.NET Framework 3.5”、“Windows 子系统 Linux”和“开发者模式”。
在线,它可以正常工作(显然以管理员身份运行):
cls
@echo off
cd /d "%~dp0"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /v "AllowDevelopmentWithoutDevLicense" /d "1" /f >nul
dism /online /add-capability /capabilityname:Tools.DeveloperMode.Core~~~~0.0.1.0 /norestart
dism /online /enable-feature /featurename:NetFx3 /norestart
dism /online /enable-feature /featurename:LegacyComponents /norestart
dism /online /enable-feature /featurename:DirectPlay /norestart
dism /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /norestart
pause
exit
但是离线,我无法获得包裹。为此,我尝试升级离线映像以在“/sources/sxs”之类的文件夹中查找包。
我解压缩了 Windows 10 的“.iso”映像。此命令为我提供了“Pro”安装的编号 = 6。
dism /get-imageinfo /imagefile:"%cd%\Windows 10 x64\sources\install.wim"
我安装图像。
if not exist "C:\test\offline" mkdir "C:\test\offline"
dism /mount-image /imagefile:"%cd%\Windows 10 x64\sources\install.wim" /index:6 /mountdir:"C:\test\offline"
直到这里,它才有效。但就在那之后,开发者模式失败了。
dism /image:"C:\test\offline" /add-capability /capabilityname:Tools.DeveloperMode.Core~~~~0.0.1.0 /logpath:"%~dpn0.log"
错误:0x800f081f 找不到源文件。使用“源”选项指定恢复功能所需文件的位置。有关指定源位置的详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=243077。
之后,.NET Framework 3.5 也失败了,同样的错误代码。
dism /image:C:\test\offline /enable-feature /featurename:NetFx3 /logpath:"%~dpn0.log"
否则,LegacyComponent、DirectPlay 和 Linux 工作正常。
dism /image:C:\test\offline /enable-feature /featurename:LegacyComponents
dism /image:C:\test\offline /enable-feature /featurename:DirectPlay
dism /image:C:\test\offline /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux
之后,我卸载了映像,但找不到下载的包。
dism /unmount-image /mountdir:"C:\test\offline" /commit
我的愿望是获得“.cab”包并能够使用这样的脚本安装它们:
cls
@echo off
cd /d "%~dp0"
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /v "AllowDevelopmentWithoutDevLicense" /d "1" /f >nul
dism /online /add-capability /capabilityname:Tools.DeveloperMode.Core~~~~0.0.1.0 /limitaccess /source:"%cd%\Packages" /logpath:"%~dpn0.log" /norestart
dism /online /enable-feature /featurename:NetFx3 /limitaccess /source:"%cd%\Packages" /logpath:"%~dpn0.log" /norestart
dism /online /enable-feature /featurename:LegacyComponents /limitaccess /source:"%cd%\Packages" /logpath:"%~dpn0.log" /norestart
dism /online /enable-feature /featurename:DirectPlay /limitaccess /source:"%cd%\Packages" /logpath:"%~dpn0.log" /norestart
dism /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /limitaccess /source:"%cd%\Packages" /logpath:"%~dpn0.log" /norestart
echo.
timeout 5
del /f /q "%~dpn0.log"
你能帮我吗?
此致,