Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.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 尝试在get childitem中使用递归搜索排除文件夹_Powershell_Search_Recursion - Fatal编程技术网

Powershell 尝试在get childitem中使用递归搜索排除文件夹

Powershell 尝试在get childitem中使用递归搜索排除文件夹,powershell,search,recursion,Powershell,Search,Recursion,我是新来的PowerShell SL D:\SomeFolder get childitem-exclude-recurse-Directory 我不希望d:\somefolder\A及其内容出现在结果中,但对于“somefolder”中的其余目录,我希望得到递归结果 我尝试了上面的命令,但是,它进入了“\A”目录。这可能是由于-recurse开关导致的,因为如果我不使用它 有没有其他方法可以实现这一点?这列出了D:\SomeFolder的子文件夹,没有D:\SomeFolder\A: get-

我是新来的PowerShell

SL D:\SomeFolder get childitem-exclude-recurse-Directory

我不希望
d:\somefolder\A
及其内容出现在结果中,但对于“somefolder”中的其余目录,我希望得到递归结果

我尝试了上面的命令,但是,它进入了“\A”目录。这可能是由于
-recurse
开关导致的,因为如果我不使用它


有没有其他方法可以实现这一点?

这列出了D:\SomeFolder的子文件夹,没有D:\SomeFolder\A:

get-childitem 'D:\SomeFolder' -recurse -Directory ` 
  | ? { $_.FullName -notlike 'D:\Somefolder\A*' }

另请参见

“这可能是由于递归开关造成的,因为如果我不使用它…可能还有其他方法可以实现这一点”,因为如果您不使用它。。。然后呢?这些点上应该有什么?