此命令的工作原理是 Windows PowerShell 的参数绑定功能将 Get-ItemGet-Item 返回的 RegistryKey 对象的路径与 New-ItemProperty的LiteralPath 参数相关联。 有关详细信息,请参阅 about_Pipelines。示例3:使用 Here-String 在注册表中创建 MultiString 值此示例使用 Here-String 创建 MultiString 值。
此命令的運作方式是因為 PowerShell 的參數係結功能會將RegistryKeyGet-Item對象的路徑與New-ItemProperty的LiteralPath參數產生關聯。 如需詳細資訊,請參閱about_Pipelines。 範例3:使用 Here-String 在登錄中建立 MultiString 值 此範例會使用 Here-String 建立MultiString值。
# 批量导出注册表项Export-Registry-Path"HKCU:\Software"-OutputPath"C:\Backup\RegistryBackup.reg"# 批量导入注册表项Import-Registry-Path"C:\Backup\RegistryBackup.reg"# 批量修改注册表项$items=Get-ChildItem-Path"HKCU:\Software\MyApp"foreach($itemin$items) {Set-ItemProperty-Path$item.PSPath-Name"...
New-ItemProperty -Path $key.PSPath -Name MaxAllowed -PropertyType QWord -Value 1024 Output 复制 MaxAllowed : 1024 PSPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\MySoftwareKey PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software PSChildName : My...
New-ItemProperty returns a custom object that contains the new property. Examples Add a registry entry: PS C:\>New-ItemProperty-Path"HKLM:\Software\MyCompany"-Name"NoOfEmployees"-Value822PS C:\>Get-ItemProperty"HKLM:\Software\MyCompany"PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MA...
Set-ItemProperty –Path registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerManager\Roles\12 –Name ConfigurationState –Value 2 有關此命令的更多資訊,請參閱以下主題。 設置-ItemProperty 設置伺服器等級 DNS 動態更新設置設置(可選) 如果您希望 DHCP 伺服器為 DHCP 使用者端電腦執行 DNS 動態更新,可以執行...
New-ItemProperty$testKeyEntry8-value100-propertyTypeqword 然后打开注册表编辑器,来对照一下: 向注册表中写入多种类型的值 如果你已经拿到了Microsoft.Win32.Registry对象,你还可以通过该对象的SetValue() 和 GetValue()方法来读写值。在你使用New-Item来创建新键时,返回的结果已然是Microsoft.Win32.Registry了。
输出显示该项是 Microsoft.Win32.RegistryKey 对象,该对象没有目标属性。 这解释了命令失败的原因。 路径参数按名称或值接受管道输入。 Output 复制 Get-Help Move-ItemProperty -Parameter Path -Path <String[]> Specifies the path to the current location of the property. Wildcard characters are permitted....
Get-ItemProperty:获取注册表项的属性信息。 Get-ChildItem -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE:获取指定注册表路径下的子项信息。 获取文件和文件夹信息: Get-ChildItem:获取指定路径下的文件和文件夹列表。 Get-Item:获取指定路径下的单个文件或文件夹信息。
Get-ItemProperty 读取键的值 Set-ItemProperty 设置键的值 New-ItemProperty 给键创建一个新值 Clear-ItemProperty 删除键的值内容 Remove-ItemProperty 删除键的值 New-Item, md 创建一个新键 Remove-Item, Del 删除一个键 Test-Path 验证键是否存在 注意:注册表几乎存储了Windows的核心配置。所以这也是它为什么成...