我需要根据其值删除注册表项。例如,密钥将驻留在:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
DisplayName
键将包含 StackOverFlow
。
这些注册表项的名称是 GUID,因此是随机的,所以我不能只搜索它们,唯一的方法就是上面的方法。
$path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
gci $path |? {$_.GetValue('DisplayName') -match 'StackOverflow'} | del
$path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
答案有一个额外的冒号。
难道不应该吗
$path = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'