windows: 为 windows server 启用 EMS 功能

This commit is contained in:
bin456789 2024-10-31 18:19:18 +08:00
parent ea7e846bb2
commit ecc61f80bf
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -43,6 +43,11 @@ echo list vol | diskpart | find "efi" && (
set BootType=bios set BootType=bios
) )
rem 获取 ProductType
for /f "tokens=3" %%a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions" /v ProductType') do (
set "ProductType=%%a"
)
rem 获取 BuildNumber rem 获取 BuildNumber
for /f "tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber') do ( for /f "tokens=3" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentBuildNumber') do (
set "BuildNumber=%%a" set "BuildNumber=%%a"
@ -149,12 +154,16 @@ for %%a in (RAM TPM SecureBoot) do (
) )
rem 设置 rem 设置
set EnableEMS=0
set ForceOldSetup=0 set ForceOldSetup=0
set EnableUnattended=1 set EnableUnattended=1
if "%EnableEMS%"=="1" ( rem 运行 ramdisk X:\setup.exe 的话
set EMS=/EMSPort:COM1 /EMSBaudRate:115200 rem vista 会找不到安装源
rem server 23h2 会无法运行
if "%ForceOldSetup%"=="1" (
set setup=Y:\sources\setup.exe
) else (
set setup=Y:\setup.exe
) )
if "%EnableUnattended%"=="1" ( if "%EnableUnattended%"=="1" (
@ -181,13 +190,11 @@ if %BuildNumber% GEQ 26040 if "%ForceOldSetup%"=="0" (
set ResizeRecoveryPartition=/ResizeRecoveryPartition Disable set ResizeRecoveryPartition=/ResizeRecoveryPartition Disable
) )
rem 运行 ramdisk X:\setup.exe 的话 rem 为 windows server 打开 EMS
rem vista 会找不到安装源 rem 普通 windows 没有自带 EMS 组件,暂不处理
rem server 23h2 会无法运行 if "%ProductType%"=="ServerNT" (
if "%ForceOldSetup%"=="1" ( rem set EMS=/EMSPort:UseBIOSSettings /EMSBaudRate:115200
set setup=Y:\sources\setup.exe set EMS=/EMSPort:COM1 /EMSBaudRate:115200
) else (
set setup=Y:\setup.exe
) )
%setup% %ResizeRecoveryPartition% %EMS% %Unattended% %setup% %ResizeRecoveryPartition% %EMS% %Unattended%