Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 找不到与参数名称';目录';-注册表项_Powershell - Fatal编程技术网

Powershell 找不到与参数名称';目录';-注册表项

Powershell 找不到与参数名称';目录';-注册表项,powershell,Powershell,我正在从注册表中检索路径,示例如下: $registry = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\Tools\ClientSetup\" ($path = Get-ItemProperty -Path $registry).Path $path = Split-Path -Path $path 这没关系,现在我只想返回这个位置的目录 $folders = Get-ChildItem -Path $path -Recurse -D

我正在从注册表中检索路径,示例如下:

$registry = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\Tools\ClientSetup\"
($path = Get-ItemProperty -Path $registry).Path
$path = Split-Path -Path $path
这没关系,现在我只想返回这个位置的目录

$folders = Get-ChildItem -Path $path -Recurse -Directory
运行此行显示错误
找不到与参数名称“directory”匹配的参数。


代码有什么问题?

不支持
-File
-Directory
。它们是提供者添加到标准
Get ChildItem
集合中的动态参数。请参阅前面链接的“动态参数”部分

您正在注册表提供程序而不是文件系统的上下文中使用Get-ChildItem,您确定idt在此上下文中支持
-Directory
开关吗?