add system config

This commit is contained in:
Julian Freeman
2025-12-06 12:47:24 -04:00
parent e58df80181
commit f883583b3e
4 changed files with 19570 additions and 33 deletions

View File

@@ -108,5 +108,22 @@
"Path": "./config/adobe_acrobat.reg" "Path": "./config/adobe_acrobat.reg"
} }
] ]
},
{
"Name": "System Optimize",
"Id": "System.Config",
"Version": "",
"Enabled": 1,
"PostInstall": [
{
"Type": "RegImport",
"Path": "./config/sys_optimize.reg"
},
{
"Type": "FileCopy",
"Source": "./assets/hosts",
"Destination": "$env:SystemRoot\\System32\\drivers\\etc\\hosts"
}
]
} }
] ]

19475
assets/hosts Normal file

File diff suppressed because it is too large Load Diff

40
config/sys_optimize.reg Normal file
View File

@@ -0,0 +1,40 @@
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
; 桌面显示此电脑0=显示
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000
; 桌面显示控制面板0=显示
"{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search]
; 仅搜索图标
"SearchboxTaskbarMode"=dword:00000001
; === 1. 设置“更多固定项”布局 (Win11) ===
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Start_Layout"=dword:00000001
; === 2. 关闭“显示最近添加的应用” (通过策略禁用) ===
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer]
"HideRecentlyAddedApps"=dword:00000001
; === 3. 关闭“显示最常用的应用” ===
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Start_TrackProgs"=dword:00000000
; === 4. 关闭“在开始菜单中显示推荐的文件/跳转列表” ===
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Start_TrackDocs"=dword:00000000
; === 5. 关闭“显示提示、应用促销等建议” ===
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager]
"SubscribedContent-338388Enabled"=dword:00000000
; === 6. 关闭“显示与帐户相关的通知” (Win11 新特性) ===
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Start_AccountNotifications"=dword:00000000
; === 微软拼音输入法设置 ===
[HKEY_CURRENT_USER\Software\Microsoft\InputMethod\Settings\CHS]
; 关闭“尝试必应的文本建议” (也就是云候选项/Web文本建议)
"EnableCloudCandidate"=dword:00000000

View File

@@ -31,42 +31,47 @@ foreach ($app in $apps) {
Write-Host "Installing: $($app.Name)" -ForegroundColor Yellow Write-Host "Installing: $($app.Name)" -ForegroundColor Yellow
Write-Host "==========================================" Write-Host "=========================================="
# --- 步骤 A: Winget 安装 --- if ($app.Id -eq "System.Config") {
$wingetArgs = @( # 如果是纯配置项,直接打印跳过信息
"install", Write-Host "[System Config] Skipping install..." -ForegroundColor Magenta
"--id", $app.Id,
"-e",
"--silent",
"--accept-package-agreements",
"--accept-source-agreements",
"--disable-interactivity",
"--scope", "machine"
)
# [版本检查逻辑]
# 检查 Version 是否存在且不为空字符串
if (-not [string]::IsNullOrWhiteSpace($app.Version)) {
Write-Host "-> Version: $($app.Version)"
$wingetArgs += "-v"
$wingetArgs += $app.Version
} else { } else {
Write-Host "-> Version: latest" # --- 步骤 A: Winget 安装 ---
} $wingetArgs = @(
"install",
"--id", $app.Id,
"-e",
"--silent",
"--accept-package-agreements",
"--accept-source-agreements",
"--disable-interactivity",
"--scope", "machine"
)
Write-Host "-> Installing via winget..." # [版本检查逻辑]
# 检查 Version 是否存在且不为空字符串
if (-not [string]::IsNullOrWhiteSpace($app.Version)) {
Write-Host "-> Version: $($app.Version)"
$wingetArgs += "-v"
$wingetArgs += $app.Version
} else {
Write-Host "-> Version: latest"
}
# 执行安装 Write-Host "-> Installing via winget..."
$proc = Start-Process -FilePath "winget" -ArgumentList $wingetArgs -Wait -PassThru -NoNewWindow
# 检查安装结果 (0=成功, -1978335189=已安装) # 执行安装
if ($proc.ExitCode -eq 0) { $proc = Start-Process -FilePath "winget" -ArgumentList $wingetArgs -Wait -PassThru -NoNewWindow
Write-Host "[Success]" -ForegroundColor Green
} elseif ($proc.ExitCode -eq -1978335189) { # 检查安装结果 (0=成功, -1978335189=已安装)
Write-Host "[Skip] Already installed" -ForegroundColor Yellow if ($proc.ExitCode -eq 0) {
continue # 已经安装的为了避免覆盖配置,也就不配置了 Write-Host "[Success]" -ForegroundColor Green
} else { } elseif ($proc.ExitCode -eq -1978335189) {
Write-Error "[Fail] Error code: $($proc.ExitCode)" Write-Host "[Skip] Already installed" -ForegroundColor Yellow
continue # 安装失败则跳过后续配置 continue # 已经安装的为了避免覆盖配置,也就不配置
} else {
Write-Error "[Fail] Error code: $($proc.ExitCode)"
continue # 安装失败则跳过后续配置
}
} }
# --- 步骤 B: PostInstall 配置 --- # --- 步骤 B: PostInstall 配置 ---