使用powershell根据值删除注册表项

问题描述 投票:0回答:2

我需要根据其值删除注册表项。例如,密钥将驻留在:

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

DisplayName
键将包含
StackOverFlow

这些注册表项的名称是 GUID,因此是随机的,所以我不能只搜索它们,唯一的方法就是上面的方法。

powershell scripting registry
2个回答
4
投票
$path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'

gci $path |? {$_.GetValue('DisplayName') -match 'StackOverflow'} | del

0
投票

$path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'

答案有一个额外的冒号。

难道不应该吗

$path = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'

© www.soinside.com 2019 - 2024. All rights reserved.