【powershell】清理注册表
·
# 警告:此脚本有风险,使用前请备份注册表
# 搜索并删除包含"Acrobat"的注册表项
$registryRoots = @(
"HKLM:\SOFTWARE",
"HKCU:\SOFTWARE",
"HKLM:\SOFTWARE\Wow6432Node"
)
foreach ($root in $registryRoots) {
if (Test-Path $root) {
Get-ChildItem -Path $root -Recurse -ErrorAction SilentlyContinue |
Where-Object { $_.Name -like "*Acrobat*" -or $_.PSChildName -like "*Acrobat*" } |
ForEach-Object {
Write-Host "删除: $($_.Name)"
Remove-Item -Path $_.PSPath -Recurse -Force -ErrorAction SilentlyContinue
}
}
}
# 清理注册表中的Adobe相关键值
$keyPaths = @(
"HKLM:\SOFTWARE\Classes\Installer\Products",
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
)
foreach ($path in $keyPaths) {
if (Test-Path $path) {
Get-ChildItem -Path $path -ErrorAction SilentlyContinue |
Get-ItemProperty -ErrorAction SilentlyContinue |
Where-Object { $_.DisplayName -like "*Acrobat*" -or $_.ProductName -like "*Acrobat*" } |
ForEach-Object {
Write-Host "删除安装信息: $($_.PSPath)"
Remove-Item -Path $_.PSPath -Recurse -Force -ErrorAction SilentlyContinue
}
}
}
更多推荐
所有评论(0)