# --- 代码开始 --- $shell = New-Object -ComObject WScript.Shell $paths = @( [Environment]::GetFolderPath("Desktop"), [Environment]::GetFolderPath("CommonDesktopDirectory"), [Environment]::GetFolderPath("StartMenu"), [Environment]::GetFolderPath("CommonStartMenu") ) Write-Host "正在扫描 WPS 相关快捷方式..." -ForegroundColor Cyan foreach ($path in $paths) { if (Test-Path $path) { # 这里加了筛选,只看名字里带 WPS 的文件 $files = Get-ChildItem -Path $path -Recurse -Filter "*WPS*.lnk" -ErrorAction SilentlyContinue foreach ($file in $files) { try { $shortcut = $shell.CreateShortcut($file.FullName) # 只要有快捷键就清除 if ($shortcut.Hotkey -and $shortcut.Hotkey -ne "") { $oldKey = $shortcut.Hotkey $shortcut.Hotkey = "" $shortcut.Save() Write-Host "已移除 WPS 快捷键: $($file.Name)" -ForegroundColor Yellow Write-Host " 原快捷键: $oldKey" } } catch {} } } } Write-Host "清理完成。" -ForegroundColor Cyan # --- 代码结束 ---