Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.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_Search - Fatal编程技术网

如何使用PowerShell在目录中递归搜索所有文件,包括隐藏目录中的隐藏文件?

如何使用PowerShell在目录中递归搜索所有文件,包括隐藏目录中的隐藏文件?,powershell,search,Powershell,Search,要递归搜索隐藏文件,我使用: gci -Path C:\ -Filter part_of_filename* -Recurse -Force | where { $_.Attributes -match "Hidden"} 输出显示了许多与此完全相同的错误(取决于路径): Get ChildItem:无法访问路径“C:\Documents and Settings” 否认。在 C:\Users\USERNAME\Documents\powershell\searchdisk.ps1:10 字符

要递归搜索隐藏文件,我使用:

gci -Path C:\ -Filter part_of_filename* -Recurse -Force | where { $_.Attributes -match "Hidden"}
输出显示了许多与此完全相同的错误(取决于路径):

Get ChildItem:无法访问路径“C:\Documents and Settings” 否认。在 C:\Users\USERNAME\Documents\powershell\searchdisk.ps1:10 字符:5
+gci你做得对。只需在提升的控制台中运行它,然后卸下过滤器。如果您不关心权限错误,请附加
-ErrorAction SilentlyContinue

Get-ChildItem -Path C:\ -Filter lush* -Recurse -Force `
              -ErrorAction SilentlyContinue


Directory: C:\

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-arhs        25.09.2013     12:16       1208 lush.asx
lush.asx
具有只读、隐藏和系统属性


您可能还希望通过管道连接到
;选择名称、长度、目录
,以摆脱不幸的
目录:C:\
行。如果希望完整路径不包含文件名,还可以使用
DirectoryName

这肯定需要使用提升的右侧运行。问题是文档和设置不是目录,而是连接点。一些NTFS技巧使程序相信目录仍然存在,而它实际上是用户的快捷方式。这是一个关于这个话题的问题: