CMD树命令限制级别数 [英] CMD tree command limit number of levels

查看:263
本文介绍了CMD树命令限制级别数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何限制Windows中tree命令通过的级别数?我需要将结果输出到一个文本文件中进行工作,但是由于默认情况下tree命令列出了您在其中运行命令的目录下的每个目录,因此我得到的输出超过44,000行,这无济于事完全是为了我的工作。

How do I limit the number of levels that the tree command goes through in Windows? I need to output the results to a text file for work, but because by default the tree command lists every single directory under the one you ran the command in, the output I'm getting is over 44,000 lines long, which isn't helpful at all for my work. How do I restrict it to listing just the first couple levels?

推荐答案

由于我在这里找不到完整的答案,因此如何将其限制为仅列出前几个级别。就是这样:

Since I didn't found complete answer here. Here it is:

Windows CMD不支持 -L 深度级别。

Windows CMD doesn't support -L depth levels.


  1. 安装CygWin https://www.cygwin.com

  2. 在Cygwin中,请确保选择已安装的实用程序/树包。

  3. 打开CygWin并导航至文件夹,例如cd ../../ cygdrive / c / myFolder

  4. 列出树形结构并另存为result.txt tree -L 3> result.txt

  1. Install CygWin https://www.cygwin.com.
  2. In Cygwin make sure you pick Utilities / Tree package installed.
  3. Open CygWin and navigate to your folder, like cd ../../cygdrive/c/myFolder.
  4. List tree structure and save as result.txt tree -L 3 >result.txt.

这篇关于CMD树命令限制级别数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆