我正在尝试获取注册表项值,但我遇到了问题。
以下是我尝试执行的命令。
Get-ChildItem "HKEY_LOCAL_MACHINE\SFTWARE\Wow6432Node\Mycompany\MyProj\Model" | ForEach-Object {Get-ItemProperty $_.pspath}
但是在附加了当前工作目录的注册表项路径中,会产生如下所示的意外问题。
PS C:\Users\Administrator\Desktop\MyDoc\Core\NodeRenameMaster> Get-ChildItem "HKEY_LOCAL_MACHINE\S
FTWARE\Wow6432Node\Mycompany\MyProj\Model" | ForEach-Object {Get-ItemProperty $_.pspath}
Get-ChildItem : Cannot find path 'C:\Users\Administrator\Desktop\MyDoc\Core\NodeRenameMaster\HKEY_
LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mycompany\MyProj\Model' because it does not exist.
At line:1 char:14
+ Get-ChildItem <<<< "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mycompany\MyProj\Model" | ForEach-Object {Get-Item
Property $_.pspath}
+ CategoryInfo : ObjectNotFound: (C:\Users\Admini...\Model:String) [Get-ChildItem], ItemNotFound
Exception
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
为什么会发生?如何解决这个问题?