win11 兼容性

This commit is contained in:
dragonflylee 2021-07-29 00:38:58 +08:00
parent f51eb9d9ac
commit f5e5930c15
6 changed files with 110 additions and 38 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
Pack/AAct*.exe
Pack/Appx/*.AppxBundle
Pack/Appx/*.MsixBundle
Pack/Appx/*.Appx
*.wim
*.esd

View File

@ -0,0 +1,19 @@
{
"pinnedList": [
{
"desktopAppId": "MSEdge"
},
{
"packagedAppId": "Microsoft.WindowsStore_8wekyb3d8bbwe!App"
},
{
"packagedAppId": "windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"
},
{
"desktopAppId": "Microsoft.Windows.Explorer"
},
{
"packagedAppId": "Microsoft.WindowsTerminal_8wekyb3d8bbwe!App"
}
]
}

View File

@ -50,29 +50,12 @@ Windows Registry Editor Version 5.00
"Start_NotifyNewApps"=dword:00000000
;"Start_TrackProgs"=dword:00000000
;不显示任务视图按钮
"ShowTaskViewButton"=dword:00000000
;"ShowTaskViewButton"=dword:00000000
;禁用资源管理器通知
"ShowSyncProviderNotifications"=dword:00000000
;开始按钮右键命令提示符
"DontUsePowerShellOnWinX"=dword:00000001
;隐藏任务栏人脉
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People]
"PeopleBand"=dword:00000000
;禁用小娜
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
"AllowCortana"=dword:00000000
"DisableWebSearch"=dword:00000001
"ConnectedSearchUseWeb"=dword:00000000
"ConnectedSearchUseWebOverMeteredConnections"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
"AllowCortana"=dword:00000000
"BingSearchEnabled"=dword:00000000
"CortanaEnabled"=dword:00000000
;任务栏:"搜索框"变为"搜索图标"
"SearchboxTaskbarMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer]
;关闭应用商店中查找应用
"NoUseStoreOpenWith"=dword:00000001
@ -84,12 +67,13 @@ Windows Registry Editor Version 5.00
"GroupPrivacyAcceptance"=dword:00000001
;禁用 Windows Defender
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
"DisableAntiSpyware"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender]
"DisableAntiSpyware"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SecurityHealthService]
"Start"=dword:00000004
;[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SecurityHealthService]
;"Start"=dword:00000004
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"SecurityHealth"=-
"WindowsDefender"=-
;禁用 家庭组
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\HomeGroup]
@ -176,11 +160,11 @@ Windows Registry Editor Version 5.00
"FilteringMode"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Safety\PrivacIE\Lists\{77C8DF8B-9502-4FE8-837C-00077879A1C8}]
"Name"="EasyList China+EasyList"
"Url"="http://easylist-msie.adblockplus.org/easylistchina+easylist.tpl"
"Url"="https://easylist-msie.adblockplus.org/easylistchina+easylist.tpl"
"Enabled"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Safety\PrivacIE\Lists\{EA4CFFF6-9FDE-45F3-8129-739D045B5ECD}]
"Name"="Fanboy Adblock List"
"Url"="http://www.fanboy.co.nz/adblock/ie/fanboy-noele.tpl"
"Url"="https://www.fanboy.co.nz/adblock/ie/fanboy-noele.tpl"
"Enabled"=dword:00000001
;隐藏IE右上角的笑脸
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Restrictions]
@ -204,8 +188,6 @@ Windows Registry Editor Version 5.00
;取消OneDrive安装
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"OneDriveSetup"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"SecurityHealth"=-
;隐藏OneDrive边栏
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}]

View File

@ -0,0 +1,68 @@
@echo off
setlocal EnableDelayedExpansion
set "Dism=Dism /NoRestart /LogLevel:1"
call :ImportOptimize "C:"
rem call :RemoveAppx "C:"
goto :Exit
rem 移除自带应用 [ %~1 : 镜像挂载路径 ]
:RemoveAppx
for /f "tokens=3" %%f in ('%Dism% /English /Image:"%~1" /Get-ProvisionedAppxPackages ^| findstr PackageName ^| findstr /V WindowsStore') do (
echo.移除应用 [%%f]
%Dism% /Image:"%~1" /Remove-ProvisionedAppxPackage /PackageName:"%%f" /Quiet
)
goto :eof
rem 导入优化 [ %~1 : 镜像挂载路径 ]
:ImportOptimize
call :MountImageRegistry "%~1"
call :ImportRegistry "%~dp010.0.reg"
call :ImportRegistry "%~dp010.0.x64.reg"
call :ImportRegistry "%~dp0Context.reg"
call :UnMountImageRegistry
goto :eof
rem 导入注册表 [ %~1 : 注册表路径 ]
:ImportRegistry
if not exist "%~1" goto :eof
call :RemoveFile "%TMP%\%~nx1"
rem 处理注册表路径
for /f "delims=" %%f in ('type "%~1"') do (
set str=%%f
set "str=!str:HKEY_CURRENT_USER=HKEY_LOCAL_MACHINE\TK_NTUSER!"
set "str=!str:HKEY_LOCAL_MACHINE\SOFTWARE=HKEY_LOCAL_MACHINE\TK_SOFTWARE!"
set "str=!str:HKEY_LOCAL_MACHINE\SYSTEM=HKEY_LOCAL_MACHINE\TK_SYSTEM!"
set "str=!str:CurrentControlSet=ControlSet001!"
echo !str!>>"%TMP%\%~nx1"
)
reg import "%TMP%\%~nx1"
goto :eof
rem 加载注册表 [ %~1 : 镜像挂载路径 ]
:MountImageRegistry
reg load HKLM\TK_NTUSER "%~1\Users\Default\ntuser.dat" >nul
reg load HKLM\TK_SOFTWARE "%~1\Windows\System32\config\SOFTWARE" >nul
reg load HKLM\TK_SYSTEM "%~1\Windows\System32\config\SYSTEM" >nul
goto :eof
rem 卸载注册表
:UnMountImageRegistry
reg unload HKLM\TK_NTUSER >nul 2>&1
reg unload HKLM\TK_SOFTWARE >nul 2>&1
reg unload HKLM\TK_SYSTEM >nul 2>&1
goto :eof
rem 删除文件 [ %~1 : 文件路径 ]
:RemoveFile
if exist "%~1" cmd.exe /c del /f /q "%~1"
goto :eof
rem 删除目录 [ %~1 : 目录路径 ]
:RemoveFolder
if exist "%~1" cmd.exe /c rd /q /s "%~1"
goto :eof
:Exit
endlocal EnableDelayedExpansion
title 操作完成

View File

@ -69,13 +69,12 @@ rem
call :RemoveAppx "%~1"
for /f %%f in ('type "%~dp0Pack\FeatureList.%ImageShortVersion%.txt" 2^>nul') do call :RemoveCapability "%~1", "%%f"
for /f %%f in ('type "%~dp0Pack\RemoveList.%ImageVersion%.txt" 2^>nul') do call :RemoveComponent "%~1", "%%f"
call :IntRollupFix "%~1"
call :AddAppx "%~1", "DesktopAppInstaller", "VCLibs"
call :AddAppx "%~1", "Store", "UI.Xaml Runtime Framework"
call :AddAppx "%~1", "WindowsCalculator"
call :AddAppx "%~1", "XboxGamingOverlay"
rem call :IntRollupFix "%~1"
rem call :AddAppx "%~1", "DesktopAppInstaller", "VCLibs"
call :AddAppx "%~1", "WindowsStore", "VCLibs UI.Xaml Runtime Framework"
call :ImportOptimize "%~1"
call :ImportUnattend "%~1"
call :ImageClean "%MNT%"
%Dism% /Unmount-Wim /MountDir:"%~1" /Commit
goto :eof
@ -88,8 +87,8 @@ call :RemoveAppx "%MNT%"
for /f %%f in ('type "%~dp0Pack\FeatureList.%ImageShortVersion%.txt" 2^>nul') do call ::RemoveCapability "%MNT%", "%%f"
for /f %%f in ('type "%~dp0Pack\RemoveList.%ImageVersion%.txt" 2^>nul') do call :RemoveComponent "%MNT%", "%%f"
call :IntRollupFix "%MNT%"
call :AddAppx "%MNT%", "DesktopAppInstaller", "VCLibs"
call :AddAppx "%MNT%", "Store", "VCLibs Runtime Framework"
call :AddAppx "%MNT%", "WindowsStore", "VCLibs Runtime Framework UI.Xaml"
call :AddAppx "%MNT%", "DesktopAppInstaller", ""
call :AddAppx "%MNT%", "WacomTechnologyCorp", "UWPDesktop"
call :ImportOptimize "%MNT%"
call :ImportUnattend "%MNT%", "OEM"
@ -225,7 +224,11 @@ if "%ImageShortVersion%" equ "10.0" (
if "%ImageVersion%" leq "10.0.17134" Reg add "HKLM\TK_SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "DeferFeatureUpdatesPeriodInDays" /t REG_DWORD /d "365" /f >nul
rem 右键菜单优化
call :ImportRegistry "%~dp0Pack\Optimize\Context.reg"
call :ImportStartLayout "%~1", "%~dp0Pack\StartLayout.xml"
if "%ImageVersion%" lss "10.0.22000" (
call :ImportStartLayout "%~1", "LayoutModification.xml"
) else (
call :ImportStartLayout "%~1", "LayoutModification.json"
)
)
call :UnMountImageRegistry
goto :eof
@ -290,7 +293,7 @@ goto :eof
rem 导入开始菜单布局文件 [ %~1 : 镜像挂载路径, %~2 布局文件路径 ]
:ImportStartLayout
copy /y "%~2" "%~1\Users\Default\AppData\Local\Microsoft\Windows\Shell\LayoutModification.xml" >nul
copy /y "%~dp0Pack\%~2" "%~1\Users\Default\AppData\Local\Microsoft\Windows\Shell\%~2" >nul
call :RemoveFile "%~1\Users\Default\AppData\Local\TileDataLayer"
goto :eof
@ -302,7 +305,7 @@ set LicPath=/SkipLicense
if "%ImageArch%" equ "x86" ( set "AppxArch=*x86*" ) else ( set "AppxArch=*" )
for /f %%f in ('"dir /b %Apps%\*%~2*.xml" 2^>nul') do ( set LicPath=/LicensePath:"%Apps%\%%f" )
for %%j in (%~3) do for /f %%i in ('"dir /b %Apps%\*%%j%AppxArch%.appx" 2^>nul') do ( set Dependency=!Dependency! /DependencyPackagePath:"%Apps%\%%i" )
for /f %%i in ('"dir /b %Apps%\*%~2*.appxbundle" 2^>nul') do (
for /f %%i in ('"dir /b %Apps%\*%~2*.*xbundle" 2^>nul') do (
echo.集成应用 [%%~ni]
%Dism% /Image:"%~1" /Add-ProvisionedAppxPackage /PackagePath:"%Apps%\%%i" %LicPath% %Dependency% /Quiet
)
@ -319,11 +322,10 @@ goto :eof
rem 移除自带应用 [ %~1 : 镜像挂载路径 ]
:RemoveAppx
for /f "tokens=3" %%f in ('%Dism% /English /Image:"%~1" /Get-ProvisionedAppxPackages ^| findstr PackageName') do (
for /f "tokens=3" %%f in ('%Dism% /English /Image:"%~1" /Get-ProvisionedAppxPackages ^| findstr PackageName ^| findstr /V SecHealthUI') do (
echo.移除应用 [%%f]
%Dism% /Image:"%~1" /Remove-ProvisionedAppxPackage /PackageName:"%%f" /Quiet
)
for /f %%f in ('dir /a:d /b "%CD%\Mount\Program Files\WindowsApps"') do call :RemoveFolder "%CD%\Mount\Program Files\WindowsApps\%%f"
goto :eof
rem 移除系统功能 [ %~1 : 镜像挂载路径, %~2 : 功能名称 ]