我无法使用PowerShell复制注册表子树,因为某些键包含斜杠(例如HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\Languages\Language Services\C/C++
)
PS > Copy-Item -recurse HKCU:\Software\Microsoft\VisualStudio\11.0\Languages HKCU:\ZZZ
Copy-Item : The registry key at the specified path does not exist.
At line:1 char:1
+ Copy-Item -recurse HKCU:\Software\Microsoft\VisualStudio\11.0\Languages HKCU:\So ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (HKEY_CURRENT_US...odeExpansions\C:String) [Copy-Item], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.CopyItemCommand
Copy-Item : The registry key at the specified path does not exist.
At line:1 char:1
+ Copy-Item -recurse HKCU:\Software\Microsoft\VisualStudio\11.0\Languages HKCU:\So ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (HKEY_CURRENT_US...uage Services\C:String) [Copy-Item], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.CopyItemCommand
如何递归复制此类子树?
这是PowerShell中的一个已知的错误-它不能处理向前注册表路径斜杠(适用于get-childitem
,所以我希望它也能影响copy-item
,rename-item
,move-item
等)。
https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=238838&SiteID=99
并且仍然存在于最新的Powershell(v4.0)中。
但是,您可以使用powershell运行Reg DOS命令:http : //technet.microsoft.com/zh-cn/library/cc742057.aspx
reg.exe copy HKCU:\Software\Microsoft\VisualStudio\11.0\Languages HKCU:\ZZZ /s
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句