Sau*_*cey 4 windows powershell command-line tree
我想使用 Tree 命令列出指定级别的所有目录。我喜欢 Tree 命令排序并使用 ASCII 来显示目录或文件夹以及这些文件夹中的所有文件夹的方式。
这就是我到目前为止所拥有的。我想用 -Depth 2 或类似的东西修改这个命令。这个命令对于列出所有目录非常有用,但我只希望它们下降到一定的级别。我希望这可以帮助你帮助我:)
树| 选择对象-跳过 2 | 设置-内容list20.txt
正如我们所知,Tree 不是 PowerShell cmdlet,因此不能用于您想要执行的操作。
\n\n对于你想要的东西,你必须自己写这个或者寻找已经完成的东西。
\n\n您无法像使用 Get-ChildItem 等那样过滤外部 .exe,而无需使用可用的正常对象遍历工作将其所有输出捕获为对象。
\n\n如果您搜索此类解决方案,您会遇到以下示例:
\n\nPowerTip:将 Get-Childitem 限制在树中的有限深度
\n\nGet-Childitem C:\\Users\\CurlyBlue -include *.docx -depth 2\nRun Code Online (Sandbox Code Playgroud)\n\nPowerTip:使用 PowerShell 以树形式查看目录列表
\n\nShow-Tree e:\\data \xe2\x80\x93depth 2\nRun Code Online (Sandbox Code Playgroud)\n\n\n\nget-childitem -Path Q:\\ -Recurse -Directory -Depth 3|select FullName|export-csv C:\\file-tree.csv\n\n\n# or this way\n\n(get-childitem -Path d:\\projects -Recurse -Directory -Depth 2).FullName\nRun Code Online (Sandbox Code Playgroud)\n\n还有许多其他选项可以对此进行挖掘。都可以在网上搜索到。
\n\n例如:\n另请参阅
\n\n以树状格式列出目录内容,并带有颜色和大量选项
\n| 归档时间: |
|
| 查看次数: |
16516 次 |
| 最近记录: |