MS-DOS and Windows command line tree command

Представляет графически дерево каталогов заданного пути или диска.

Параметры командной строки:

/F – Вывод имен файлов в каждой папке.

/A – Использовать символы ASCII вместо символов псевдографики.

tree /? – отобразить подсказку по использованию команды.

Весь список команд CMD Windows

PsList is a command line tool that is part of the Sysinternals suite. It allows you to list Windows processes and get information about running processes and their runtime characteristics, including CPU and memory usage, parent–child relationships, and thread information.

PsList has several options for showing different types of characteristics. To display the options, run pslist /?.


MS-DOS and Windows command line tree command

PsList command line options

PsList is available in both 32-bit (pslist.exe) and 64-bit versions (pslist64.exe). Both versions provide the same results. Obviously, you can run pslist.exe on both architectures, but you cannot run pslist64.exe on a 32-bit system.

Updated: by

Availability


MS-DOS and Windows command line tree command

The tree command typed alone produces a listing and overview of the current directory (shown in the image to the right).

In the example, C: is the current directory, “banners” is one of the directories, and “big” is a subdirectory of the “cdn” directory.

The command above uses the tree command with the /F switch. The resulting output would include the names of files located in each of the directories in the tree. Depending on how many files are located in each directory, the tree listing could be quite long.

To output the structure of a directory to a file, and other options, try using the dir command.

I don’t see why you don’t want to p/invoke. If you look at System. Diagnostics in Reflector, you’ll see that it uses p/invokes internally. Anyway, the Process class does not have a way of retrieving a process’ parent PID. Instead:

The struct definition:

The (simplified) function import:

Process p = Process. GetProcessById(1234);
PROCESS_BASIC_INFORMATION pbi;
int size;

NtQueryInformationProcess(p. Handle, 0, out pbi, Marshal. SizeOf(typeof(PROCESS_BASIC_INFORMATION)), out size);
// pbi. InheritedFromUniqueProcessId now contains the process’ parent PID

You’ll need to insert these usings at the top of your file:

using System. Runtime. InteropServices;
using System. Diagnostics;

If you want to enumerate processes, you’d be better off using NtQuerySystemInformation – although that code is a bit too long to post here.

In Linux/KDE, I can see a directory as a tree. How can I do it in Windows 7?

Consider I do NOT mean “Windows Explorer”. This just shows the directories, I also want the files.

6 gold badges64 silver badges89 bronze badges

asked Mar 1, 2012 at 15:11

In the Windows command prompt you can use “tree /F” to view a tree of the current folder and all descending files & folders.

In File Explorer under Windows 8.1:

You now have an editable tree structure file.

This works for versions of Windows from Windows XP to Windows 8.1.

1 gold badge6 silver badges12 bronze badges

answered Mar 1, 2012 at 15:17

1 gold badge14 silver badges14 bronze badges

tree /f /a

The Windows command tree /f /a produces a tree of the current folder and all files & folders contained within it in ASCII format.

answered Aug 10, 2016 at 10:37

4 gold badges62 silver badges74 bronze badges

I recommend WinDirStat.

It even uses the correct icons for Windows registered file types.

All I would say is missing is an option to display the files without their icons. I can live without it personally, since I am usually pasting the image into a paint program or Visio to edit it, but it would still be a useful feature.

:/>  KB971033 и что делать, если слетела активация Корпоративной Windows 7

answered May 11, 2016 at 17:02

If it is just viewing in tree view,One workaround is to use the Explorer in Notepad++ or any other tools.

answered Apr 17, 2014 at 10:44

1 gold badge10 silver badges11 bronze badges

TreeSize professional has what you want. but it focus on the sizes of folders and files.

answered Aug 15, 2013 at 16:07

5 gold badges30 silver badges51 bronze badges

You can use Internet Explorer to browse folders and files together in tree. It is a file explorer in Favorites Window. You just need to replace “favorites folder” to folder which you want to see as a root folder

answered Feb 19, 2015 at 18:01

Looking back, the early computer designers realized that merging multiple files on your computer systems would create huge junk and make it impossible to find anything. Hence, ‘Directory’ was created on Windows systems. Directory, directory system, directory structure and directory tree are many names for the same thing.

In simple terms, a directory structure (or system or tree) is the simple arrangement of directories in a computer system. We’ve all heard about directory structures and folder trees for years. Let’s start using it today as it can greatly improve your organization’s workflow. Now it’s easy to export an entire directory tree from a specific folder in Windows 11 or Windows 10. But there is no easy way to create a folder tree in Windows 11/10.

File Explorer helps you quickly browse or open files on Windows 10 system. Users can navigate through directories using back, forward, up, navigation menus, directly enter the location in the address bar, and scroll left or right pane.

But Windows Explorer doesn’t let you understand the entire directory structure. If you’ve spent an absurd amount of time scrolling through hundreds of files trying to find the right one, then the folder tree can make a difference. We already mentioned that there is no direct way to view folders/files in tree format in Windows Explorer. The ‘Tree Command’ could work here.

The tree command can make it very easy to keep track of files and folders using the command line. You can see how a directory is structured on your system and where each file is located. Let’s see how to do it.

Please note that in our case we selected the C:Drivers folder.

MS-DOS and Windows command line tree command

This will create a new folder tree named ‘Test’ in the C:Drivers folder.

Double click a file and you can see the structured tree format of all files.

MS-DOS and Windows command line tree command

A folder tree can be created for any specific folder in Windows 10. So, if the folder is located in ‘F:est’, then the command should be changed to the following command:

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?

159 gold badges612 silver badges957 bronze badges

asked Aug 10, 2015 at 19:13

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

Windows CMD doesn’t support -L depth levels.

:/>  Как включить dhcp cmd

10 gold badges51 silver badges80 bronze badges

answered Nov 16, 2016 at 12:26

5 gold badges27 silver badges44 bronze badges

Actually, the tree command in DOS and Windows does not have the option for specifying the directory level that the command goes through. You can refer to the documentation of tree on Microsoft Docs.

tree -L 3 // three levels show

answered Apr 22, 2016 at 2:34

5 silver badges7 bronze badges

answered Jan 12, 2020 at 15:22

8 silver badges15 bronze badges

Example 3 levels:

answered Dec 15, 2020 at 16:37

If you use WSL you can also export the result straight to the Windows clipboard

That’ll bypass saving it to a txt file and go straight to your clipboard for quick pasting into forums, etc.

answered Dec 17, 2020 at 18:51

J. Scott ElbleinJ. Scott Elblein

15 gold badges58 silver badges94 bronze badges

I know the question is old, but here in Powershell :

answered Jan 24, 2022 at 11:11

Also you can try

It will give you result like that:

Also you can filter it

tasklist /M /FI “xxx”

Where as xxx you can specyfi filter parameters

tasklist /M /FI “IMAGENAME eq explorer.exe”

Which give’s you something similar:

Solution 1

You could use a program called Process Monitor. This program allows you to do what you want.

It also provides exactly what you want:

Process tree tool shows relationship of all processes referenced in a trace.

Параметры

Задает дисковод, содержащий диск, графическое представление дерева каталогов которого будет
выведено.

Задает каталог, для которого будет выведена структура подкаталогов.

Выводит имена файлов в каждом каталоге.

Задает использование командой tree текстовых символов вместо графических для вывода
связей между каталогами.

Отображает справку в командной строке.

List local Windows processes


MS-DOS and Windows command line tree command

PsList basic output

Note: Unlike Task Manager and other tools, PsList does not show pseudo-processes named System Idle Process and System Interrupts but combines these two values into one value named Idle.

To list Windows processes in a tree view, use the -t option. With this option, the child processes will be listed below their parent process. Also notice that the process CPU information is replaced by memory information: reserved virtual memory (VM), working set (WS), and private virtual memory (Priv).


MS-DOS and Windows command line tree command

Process tree view output

Memory-related information is displayed with the use of the -m option. This will show the three memory indicators already mentioned in the -t option, plus peak private virtual memory (Priv Pk), page faults (Faults), nonpaged (NonP), and paged (Page) pool sizes. All sizes are shown in kilobytes.

Another possibility is to display information about each thread in the system. This is done using the -d option. The output is quite excessive and shows, for example, the number of context switches (Cswtch), its current state (State), and much more.


MS-DOS and Windows command line tree command

PsList shows excessive thread information

Create TXT output

Unlike some other tools, PsList has no built-in export options available. The only option is to use the standard console redirection syntax.

Copying the results to an Excel sheet requires a bit more effort, as each line is inserted into one cell with multiple spaces between each value.

Solution 2

Use pslist64.exe -t from SysInternals.

Filtering and refreshing the output

As previously mentioned, the PsList output can be very large and unreadable. Therefore, you can limit the command to list only information about one or more specific Windows processes. Filtering can be done using process ID (PID) and partial or exact names. Add the -e option to match the name exactly. See the screenshot below for examples.

:/>  «Невозможность инициировать загрузку с жесткого диска и жесткого диска через BIOS очевидна, несмотря на обнаружение диска через указанную систему. Кроме того, попытки настроить приоритет загрузки оказались бесполезными для создания загрузочных вышеупомянутых дисков»


MS-DOS and Windows command line tree command

PsList filtering examples

The last option to mention is PsList’s ability to refresh the results periodically. This is done using the -s option. The default refresh rate is 1 second, and the results are refreshed until canceled by the Escape key. You can change the refresh rate by adding the -r option, and you can limit the duration of the data collection by adding a number of seconds after the -s option. For example, pslist -s 600 -r 5 will run for 10 minutes with a refresh rate of five seconds. You can combine the -s option with -m (memory information) or -t (process tree).

Примеры

Для вывода имен всех подкаталогов на текущем диске служит следующая команда:

Для постраничного вывода имен файлов во всех каталогах диска C можно использовать следующую
команду:

Для печати списка файлов из предыдущего примера может быть использована следующая команда:

Для вопросов, обсуждений, замечаний, предложений и т. п. можете использовать
раздел форума
этого сайта (требуется регистрация).

Solution 3

Try Process Exporer from Sysinternals. It is like an advanced task manager, there is a tree view as well.

Related videos on Youtube


MS-DOS and Windows command line tree command

02 : 37

21 : 18


MS-DOS and Windows command line tree command

22 : 41

Windows Process Genealogy


MS-DOS and Windows command line tree command

01 : 57

How to list a process tree on Windows?


MS-DOS and Windows command line tree command

01 : 45

How to view process tree using Process Monitor in Windows

Comments

To kill a whole tree with ALL!!! childs:


MS-DOS and Windows command line tree command

12 : 15

Operation on Processes – Process Creation


MS-DOS and Windows command line tree command

11 : 16


MS-DOS and Windows command line tree command

09 : 16

Operation on Processes – Process Termination


MS-DOS and Windows command line tree command

10 : 14


MS-DOS and Windows command line tree command

09 : 01

How to List and Kill a Running Windows Process in Task Manager using Powershell – January 2021

I Think I Am Going To Get An Error!


MS-DOS and Windows command line tree command

08 : 36

Задает дисковод, содержащий диск, графическое представление дерева каталогов которого будет
выведено.

Задает использование командой tree текстовых символов вместо графических для вывода
связей между каталогами.

Для постраничного вывода имен файлов во всех каталогах диска C можно использовать следующую
команду:

Новый раздел о средствах командной строки в рамках этого же проекта расположен
здесь

Use Job Objects.

It’s the closest thing to a unix ‘process group’ that windows has to offer.

Job Objects allow you to indicate a child process (and all its children) can be managed together, esp. for being killed. Unlike unix, as of this writing ‘job objects’ cannot be nested. Which means if a parent creates a job object for a child, all that child’s children cannot themselves use Job Objects (which is a /severe/ limitation IMHO, like a file system that only allows one level of sub directories).

List remote Windows processes

PsList does not support querying multiple computer names in one command. To query information from a remote system:

pslist \ws2022 or pslist \192.168.1.10

To filter the results, use the same syntax as locally. The command below will show all information related to process svchost.exe, matching the name exactly.

pslist \ws2022 -e svchost

Check this thread for grouping processes within a “job”.