# ========================================================= # MAX Windows Toolkit - 系统优化 # ========================================================= $Common = "C:\Setup\windows\lib\common.ps1" if (Test-Path $Common) { . $Common } Show-AdminWarn Write-Header "系统优化" # ── 资源管理器设置 ── Write-Section "资源管理器设置" try { New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Force | Out-Null Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ` -Name "HideFileExt" -Type DWord -Value 0 Write-OK "显示文件扩展名" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ` -Name "Hidden" -Type DWord -Value 1 Write-OK "显示隐藏文件" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ` -Name "LaunchTo" -Type DWord -Value 1 Write-OK "资源管理器默认打开此电脑" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ` -Name "TaskbarAl" -Type DWord -Value 0 Write-OK "任务栏图标左对齐" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ` -Name "TaskbarDa" -Type DWord -Value 0 -ErrorAction SilentlyContinue Write-OK "隐藏任务栏小部件" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ` -Name "TaskbarMn" -Type DWord -Value 0 -ErrorAction SilentlyContinue Write-OK "隐藏任务栏聊天" Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ` -Name "ShowTaskViewButton" -Type DWord -Value 0 -ErrorAction SilentlyContinue Write-OK "隐藏任务视图按钮" Write-Info "恢复经典右键菜单..." reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve | Out-Null Write-OK "经典右键菜单已恢复" } catch { Write-Err "资源管理器设置失败" Write-Muted $_.Exception.Message } # ── 快速启动 ── Write-Section "快速启动设置" try { reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Power" /v HiberbootEnabled /t REG_DWORD /d 0 /f Write-OK "已禁用快速启动" } catch { Write-Err "禁用快速启动失败" Write-Muted $_.Exception.Message } # ── 远程桌面 ── Write-Section "远程桌面" try { Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" ` -Name "fDenyTSConnections" -Value 0 Enable-NetFirewallRule -DisplayGroup "Remote Desktop" -ErrorAction SilentlyContinue Write-OK "已启用远程桌面" } catch { Write-Err "启用远程桌面失败" Write-Muted $_.Exception.Message } # ── 电源方案 ── Write-Section "电源方案" try { powercfg /setactive SCHEME_MIN Write-OK "已应用高性能电源方案" } catch { Write-Err "电源方案设置失败" Write-Muted $_.Exception.Message } Write-Line Write-OK "系统优化完成" Pause-Max