人生,不止代码
123
# 创建注册表项$registryKey = "HKLM:\SOFTWARE\Example"$registryItem = New-Item -Path $registryKey -Force
12345
# 读取注册表$registryKey = "HKLM:\SOFTWARE\Example"$registryItem = Get-Item -Path $registryKeyWrite-Host "注册表项内容:"$registryItem.GetValueNames() | ForEach-Object { Write-Host "$_ = $($registryItem.GetValue($_))" }
1234
# 添加或修改值$propertyName = "TestValue"$propertyValue = "This is a test value"Set-ItemProperty -Path $registryKey -Name $propertyName -Value $propertyValue
12345678
# 删除注册表值$registryKey = "HKLM:\SOFTWARE\Example"$propertyName = "TestValue"Remove-ItemProperty -Path $registryKey -Name $propertyName# 删除整个注册表项$registryKey = "HKLM:\SOFTWARE\Example"Remove-Item -Path $registryKey -Recurse -Force
stay hungry, stay foolish