有没有一个命令,我可以在Windows Server 2008 R2上运行,只会显示包含某个单词的目录。
例如,我想查找所有包含“日志”的目录
这意味着它将返回这些所有位置,因为它们包含单词“日志”
C:\Logs C:\stuff\ServerLogs C:\example\Logsforapps
在cmd你可以做一个: dir /a:d /b /s C:\*logs*
或者如果你有最新的PowerShell版本
Get-ChildItem -Directory -Path C: -Recurse -Filter *logs* | Select-Object FullName
Powershell可以提供以下内容:
gci -rc:\temp | where {$_.psIsContainer -eq $true -and $_.name -match "logs"} | foreach { $_.fullname }
使用内置于服务器2008+的文件分类基础结构(FCI)工具来查询具有特定单词的文件。
如何find他们的“日志”的目录。
例如:log filetype:目录将返回所有包含单词log的目录。 请记住select起始文件夹。 示例:文档search将只返回在默认文档文件夹中find的内容。 C:\ Windows将返回Windows文件夹中的所有内容。 使用pipe理员权限selectC:\驱动器应该可以让你在C:盘上find所有的东西。 如果您有多个驱动器,请select“计算机”,然后search关键字文件types:目录
用简单的脚本更新。
Dim objShell Set objShell = WScript.CreateObject("WScript.Shell") objShell.Run ("explorer /root,""search-ms:query=logs&crumb=kind:=folder&crumb=location:&""") Set objShell = Nothing
以上将search您的explorer.exe视图中的所有内部和映射的驱动器。 位置:可以设置,如果你只需要检查select驱动器。 它看起来像
location:C:\
您可以为需要search的每个目标驱动器或文件夹path重复此操作。
&crumb=location:C:\&crumb=location:F:\directory&crumb=location:G:\
从我在2008 R2的testing中发现,仅仅离开没有目标的位置就会search所有的物理和映射驱动器。
&crumb=location: