Windows 11 系统优化 Skill
付费说明
本 Skill 为付费服务,¥9.9/次(一次付费,永久使用)。
付费流程
- 发起请求 → 系统返回 402 账单
- 完成支付 → 获取支付凭证
- 携带凭证重试 → 验证支付
- 履约确认 → 执行优化服务
402 账单下发
当用户请求优化服务时,返回账单信息:
## 💰 待支付账单
**服务**: Windows 11 系统优化
**费用**: ¥9.9
**订单号**: W11OPT-{timestamp}-{random}
请完成支付后,将支付宝支付凭证(截图或订单号)发送给我继续服务。
携带凭证重试
用户支付后携带凭证重试,调用平台验付接口:
验付调用 (alipay.aipay.agent.payment.verify)
用户携带支付凭证(支付宝订单号)重试时,执行验付:
{
"tool": "alipay.aipay.agent.payment.verify",
"parameters": {
"orderId": "W11OPT-{timestamp}",
"paymentProof": "{用户提供的支付宝订单号}",
"skillSlug": "win11-optimize",
"expectedAmount": 9.9,
"currency": "CNY"
}
}
参数说明:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| orderId | string | 是 | 订单号(与402账单中的订单号一致) |
| paymentProof | string | 是 | 支付宝支付凭证(订单号) |
| skillSlug | string | 是 | Skill唯一标识 |
| expectedAmount | number | 是 | 预期金额(9.9) |
| currency | string | 是 | 币种(CNY) |
响应示例:
{
"success": true,
"orderId": "W11OPT-1234567890",
"status": "VERIFIED",
"paidAmount": 9.9,
"verifiedAt": "2025-01-15T10:30:00Z"
}
订单持久化与幂等
# 订单存储路径(本地持久化)
$OrderDB = "$env:TEMP\win11_optimization_orders.json"
function Save-Order {
param(
[string]$OrderId,
[string]$Status,
[string]$PaymentProof
)
$orders = @()
if (Test-Path $OrderDB) {
$orders = Get-Content $OrderDB -Raw | ConvertFrom-Json
if ($orders -isnot [array]) { $orders = @($orders) }
}
# 幂等检查
$existing = $orders | Where-Object { $_.OrderId -eq $OrderId }
if ($existing) {
if ($existing.Status -eq "VERIFIED" -or $existing.Status -eq "FULFILLED") {
Write-Output "订单已存在,无需重复处理"
return $existing
}
}
# 更新或创建订单
$order = @{
OrderId = $OrderId
Status = $Status
PaymentProof = $PaymentProof
UpdatedAt = (Get-Date).ToString("yyyy-MM-dd HH:mm:ss")
}
$orders = $orders | Where-Object { $_.OrderId -ne $OrderId }
$orders += $order
$orders | ConvertTo-Json | Set-Content $OrderDB -Force
return $order
}
履约确认 (alipay.aipay.agent.fulfillment.confirm)
支付验证成功后,执行优化服务并调用履约确认接口:
调用履约确认
{
"tool": "alipay.aipay.agent.fulfillment.confirm",
"parameters": {
"orderId": "W11OPT-{timestamp}",
"skillSlug": "win11-optimize",
"fulfillmentProof": {
"serviceName": "Windows 11 系统优化",
"deliveredItems": [
"高性能电源计划",
"144Hz刷新率",
"35个服务禁用",
"启动项清理",
"虚拟内存优化"
],
"deliveredAt": "2025-01-15T10:35:00Z"
}
}
}
响应示例:
{
"success": true,
"orderId": "W11OPT-1234567890",
"status": "FULFILLED",
"fulfilledAt": "2025-01-15T10:35:00Z",
"message": "服务已完成"
}
完整履约流程代码
function Confirm-ServiceDelivery {
param(
[string]$OrderId,
[string]$PaymentProof
)
# 1. 验付调用
$verifyResult = Invoke-Tool -Name "alipay.aipay.agent.payment.verify" -Parameters @{
orderId = $OrderId
paymentProof = $PaymentProof
skillSlug = "win11-optimize"
expectedAmount = 9.9
currency = "CNY"
}
if (-not $verifyResult.success) {
throw "支付验证失败: $($verifyResult.message)"
}
# 2. 执行优化服务(省略具体命令)
Write-Output "执行 Windows 11 系统优化..."
# 3. 履约确认调用
$fulfillResult = Invoke-Tool -Name "alipay.aipay.agent.fulfillment.confirm" -Parameters @{
orderId = $OrderId
skillSlug = "win11-optimize"
fulfillmentProof = @{
serviceName = "Windows 11 系统优化"
deliveredItems = @(
"高性能电源计划",
"144Hz刷新率",
"35个服务禁用",
"启动项清理",
"虚拟内存优化"
)
deliveredAt = (Get-Date).ToString("yyyy-MM-ddTHH:mm:ssZ")
}
}
# 4. 更新本地订单状态
Save-Order -OrderId $OrderId -Status "FULFILLED" -PaymentProof $PaymentProof
return $fulfillResult
}
使用场景
- 新安装 Windows 11 系统后的完整优化
- 系统性能调优和隐私设置
- 清理不必要的服务和启动项
- 自动化配置桌面、任务管理器、刷新率等
使用方法
- 加载此 Skill
- 请求优化服务
- 完成 ¥9.9 支付
- 携带支付凭证重试
- 自动执行优化
系统信息收集
获取系统基本信息
Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer, CsProcessors, CsTotalPhysicalMemory | Format-List
获取磁盘信息
Get-Disk | Select-Object Number, FriendlyName, Size, PartitionStyle | Format-List
获取网络适配器信息
Get-NetAdapter | Select-Object Name, Status, LinkSpeed, MacAddress | Format-List
获取 Windows 版本详情
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | Select-Object ProductName, DisplayVersion, CurrentBuild, UBR
检查磁盘空间
Get-Volume | Select-Object DriveLetter, FileSystemLabel, FileSystem, @{N='Size(GB)';E={[math]::Round($_.Size/1GB,2)}}, @{N='Free(GB)';E={[math]::Round($_.SizeRemaining/1GB,2)}}, @{N='Used%';E={[math]::Round((1-$_.SizeRemaining/$_.Size)*100,1)}} | Format-Table -AutoSize
电源和性能优化
设置高性能电源计划
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
优化视觉效果(最佳性能)
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Value 2
优化内存管理
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "ClearPageFileAtShutdown" -Value 0
设置虚拟内存到D盘
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" -Name "PagingFiles" -Value "D:\pagefile.sys 8192 8192"
设置显示器刷新率 (144Hz)
$source = @"
using System;
using System.Runtime.InteropServices;
public class DisplaySettings {
[DllImport("user32.dll")]
public static extern int ChangeDisplaySettings(ref DEVMODE devMode, int flags);
[DllImport("user32.dll")]
public static extern bool EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE devMode);
[StructLayout(LayoutKind.Sequential)]
public struct DEVMODE {
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmDeviceName;
public short dmSpecVersion; public short dmDriverVersion; public short dmSize; public short dmDriverExtra;
public int dmFields; public int dmPositionX; public int dmPositionY; public int dmDisplayOrientation;
public int dmDisplayFixedOutput; public short dmColor; public short dmDuplex; public short dmYResolution;
public short dmTTOption; public short dmCollate; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string dmFormName;
public short dmLogPixels; public int dmBitsPerPel; public int dmPelsWidth; public int dmPelsHeight;
public int dmDisplayFlags; public int dmDisplayFrequency; public int dmICMMethod; public int dmDMColorScope;
public int dmReserved1; public int dmReserved2; public int dmPanningWidth; public int dmPanningHeight;
}
public static void Set144Hz() {
DEVMODE devMode = new DEVMODE(); devMode.dmSize = (short)Marshal.SizeOf(typeof(DEVMODE));
int mode = 0;
while (EnumDisplaySettings(null, mode, ref devMode)) {
if (devMode.dmDisplayFrequency == 144 && devMode.dmPelsWidth == 2560 && devMode.dmPelsHeight == 1440) {
devMode.dmFields = 0x40000000; ChangeDisplaySettings(ref devMode, 0); return;
}
mode++;
}
}
}
"@
Add-Type -TypeDefinition $source; [DisplaySettings]::Set144Hz()
禁用云内容和建议应用
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338389Enabled" -Value 0
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Value 1
禁用后台应用访问
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications" -Name "GlobalUserDisabled" -Value 1
多媒体系统响应优化
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" -Name "SystemResponsiveness" -Value 10
NTFS 优化
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "NtfsMftZoneReservation" -Value 4
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "NtfsDisableEncryption" -Value 1
I/O 页面锁定限制优化
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\I/O System" -Name "IoPageLockLimit" -Value 16777216
磁盘碎片整理
Optimize-Volume -DriveLetter C -Defrag
磁盘清理
清理临时文件
Get-ChildItem -Path "C:\Windows\Temp" -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
Get-ChildItem -Path "$env:TEMP" -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue
运行磁盘清理工具
Start-Process cleanmgr.exe -ArgumentList "/sagerun:1" -Wait -WindowStyle Hidden
设置C盘名称
Get-Volume -DriveLetter C | Set-Volume -NewFileSystemLabel "系统"
网络优化
禁用以太网省电模式
Set-NetAdapterAdvancedProperty -Name "以太网" -DisplayName "Energy Efficient Ethernet" -DisplayValue "Disabled"
优化 SMB 服务器设置
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" -Name "IRPStackSize" -Value 32
优化 TCP/IP 参数
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" -Name "EnableDeadGWDetect" -Value 0
查看网络协议绑定
Get-NetAdapterBinding -Name "以太网" | Select-Object ComponentID, DisplayName, Enabled | Format-Table -AutoSize
隐私和安全设置
禁用 Windows 遥测服务
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\DiagTrack" -Name "Start" -Value 4
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\dmwappushservice" -Name "Start" -Value 4
禁用驱动程序自动搜索更新
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" -Name "SearchOrderConfig" -Value 0
检查 Windows Defender 状态
Get-MpComputerStatus | Select-Object AntivirusEnabled, RealTimeProtectionEnabled, AntivirusSignatureLastUpdated | Format-List
启动项和服务优化
查看启动程序
Get-CimInstance -ClassName Win32_StartupCommand | Select-Object Name, Command, Location | Format-Table -AutoSize
查看自动启动但已停止的服务
Get-Service | Where-Object {$_.StartType -eq "Automatic" -and $_.Status -eq "Stopped"} | Select-Object Name, StartType, Status | Format-Table -AutoSize
禁用不必要的计划任务
Disable-ScheduledTask -TaskName "Microsoft Compatibility Appraiser Exp" -TaskPath "\Microsoft\Windows\Application Experience\"
Disable-ScheduledTask -TaskName "PcaPatchDbTask" -TaskPath "\Microsoft\Windows\Application Experience\"
Disable-ScheduledTask -TaskName "StartupAppTask" -TaskPath "\Microsoft\Windows\Application Experience\"
查看所有计划任务
Get-ScheduledTask | Where-Object {$_.State -eq "Ready" -and $_.TaskPath -like "\Microsoft\Windows\*"} | Select-Object TaskName, TaskPath, State | Format-Table -AutoSize
配置不必要的服务
$services = @(
"AxInstSV","BDESVC","WbioSrvc","WpnService","DiagTrack","dmwappushservice",
"edgeupdate","edgeupdatem","MapsBroker","lfsvc","PcaSvc","DoSvc",
"XblGipSvc","XblAuthManager","XboxNetApiSvc","XblGameSave",
"bthserv","BTAGService","WMPNetworkSvc","SharedAccess","RemoteRegistry",
"Spooler","CDPSvc","PimIndexMaintenanceSvc_5356a","InventorySvc",
"WalletService","WebClient","StiSvc","CertPropSvc","TokenBroker"
)
foreach ($s in $services) {
Set-Service -Name $s -StartupType Disabled -ErrorAction SilentlyContinue
Stop-Service -Name $s -Force -ErrorAction SilentlyContinue
}
清理启动项(只保留杀毒软件)
# 删除 OneDriveSetup 残留
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
reg delete "HKU\S-1-5-19\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
reg delete "HKU\S-1-5-20\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v OneDriveSetup /f
# 删除 Edge 自动启动
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "MicrosoftEdgeAutoLaunch_*" /f
桌面和资源管理器设置
配置资源管理器选项
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value 0
桌面图标设置
# 添加此电脑图标
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Value 0
# 设置小图标
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "IconSize" -Value 32
# 自动排列图标
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "AutoArrange" -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "AlignIcons" -Value 1
任务管理器默认起始页
New-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\TaskManager" -Force -ErrorAction SilentlyContinue
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\TaskManager" -Name "StartPage" -Value 1
Windows Update 配置
# 设置为手动通知模式(下载但可选安装)
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Value 3
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Value 0
应用管理
查看已安装的 UWP 应用
Get-AppxPackage | Where-Object {$_.IsFramework -eq $false -and $_.SignatureKind -ne "System"} | Select-Object Name, PackageFullName | Format-Table -AutoSize
注意事项
- 大部分优化需要 管理员权限
- 建议在应用优化前创建系统还原点
- 某些服务禁用可能影响特定功能
- 部分设置需要重启系统才能完全生效
- 刷新率和虚拟内存设置需要重启才能生效