Set-Location -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion 另外,可以将内置 HKLM: PSDrive 与 Set-Location 结合使用:PowerShell 复制 Set-Location -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion 然后,可以将 . 表示法用于当前位置以列出属性,而无需指定完整路径:PowerShell...
可以将*.*表示法用于引用当前位置。 可以先使用Set-Location以更改为 CurrentVersion 注册表容器: PowerShell Set-Location-PathRegistry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion 另外,可以将内置HKLM:PSDrive 与Set-Location结合使用:
# 添加默认值: > New-ItemProperty HKCU:\Software\Test3 "(default)" -value "A value" (default) : A value PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Test3 PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software PSChildName : Test3 PSDrive ...
因為登錄專案會被視為登錄機碼的屬性,也就是專案,因此您可以使用Set-ItemProperty來建立登錄專案,以及建立和變更其值。 PowerShell Set-ItemProperty-Path"HKLM:\Software\ContosoCompany"-Name"NoOfEmployees"-Value823Get-ItemProperty-Path"HKLM:\Software\ContosoCompany"PSPath : Microsoft.PowerShell.Core\Registry::...
如果你已经拿到了Microsoft.Win32.Registry对象,你还可以通过该对象的SetValue() 和 GetValue()方法来读写值。在你使用New-Item来创建新键时,返回的结果已然是Microsoft.Win32.Registry了。你需要做的无非是把它保存起来,然后按照下面的步骤操作即可: # 创建一个包含多个值的键:$key=mdHKCU:\Software\Test2$key...
theSet-ItemPropertycommand, the path is the value of thePSPathproperty of the registry key. This is a property of the Microsoft .NET Framework object that represents the registry key, not a registry entry. The command uses theToUpper()method of theRemotePathvalue, which is a stringREG_SZ....
Configuration RegistryTest { Import-DscResource -ModuleName 'PSDesiredStateConfiguration' Registry RegistryExample { Ensure = "Present" # You can also set Ensure to "Absent" Key = "HKEY_LOCAL_MACHINE\SOFTWARE\ExampleKey2" ValueName = "" } } 注意 變更HKEY_CURRENT_USER 登錄區中的登錄...
We got that the value of the SearchOrderConfig parameter is 1. Changing Registry Value with PowerShell To change the value of the SearchOrderConfig reg parameter, use the Set-ItemProperty cmdlet: Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching' -Name SearchOr...
We got that the value of the SearchOrderConfig parameter is 1. Changing Registry Value with PowerShell To change the value of the SearchOrderConfig reg parameter, use the Set-ItemProperty cmdlet: Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching' -Name SearchOr...
可以使用Set-Location首先转到CurrentVersion注册表容器: Set-Location -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion 或者,可以将内置HKLMPSDrive与Set-Location一起使用: Set-Location -Pathhklm:\SOFTWARE\Microsoft\Windows\CurrentVersion...