Команда list в windows

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

  • Home
  • Partition Magic
  • CMD List Files: How to List Files in Command Prompt Windows 10/11

By Ariel | Follow |
Last Updated

What command can be used to list files in a directory? How to list files in Command Prompt Windows 10/11? A great many people are confused about these questions. In this post, MiniTool explains the Command Prompt list files topic in detail and introduces an alternative to CMD list files.

CMD (Command Prompt) is a powerful Windows built-in tool that can be used to do many works such as CMD copy files, CMD list drives, CMD WiFi password, and more. However, a lot of users don’t how to list files in Command Prompt. Here’s a true example from the StackOverflow forum:

I tried searching for a command that could list all the files in a directory as well as subfolders using a command prompt command. I have read the help for the «dir» command but couldn’t find what I was looking for. Please help me with what command could get this.

https://stackoverflow.com/questions/15214486/command-to-list-all-files-in-a-folder-as-well-as-sub-folders-in-windows

Although there are already many discussions and posts about the Command Prompt list files, most of them lack clear steps and screenshots, which makes people difficult to understand the “CMD list files” operation. Thus, we want to write a complete guide to explain it. Let’s keep reading.

What Command Can Be Used to List Files

To list directory CMD smoothly, you need to know what command can be used to list files in a directory Windows first. The answer is to use the DIR command. This command can be used to show all files and subfolders in the current directory. In addition, it displays the file name, size, and last modification date of each file like File Explorer.

The DIR command is available in CMD for almost all Windows systems, including Windows 11/10/8/7/Vista/XP. Here are the most commonly used command lines about the CMD list directory/files:

  • D: List all directories in the current path
  • R: Show read-only files
  • H: Show hidden files
  • A: Archive files
  • S: List system files
  • I: Not content indexed files
  • L: Reparse points
  • -: Add a minus in front of any of the file attribute to let the DIR command not show that kind of file.

How to List Files in Command Prompt Windows 10/11

How to list files in CMD Windows 10/11? The answer depends on what files you want to list. Here we summarize several common examples of the Windows Command Prompt list files.

Step 1. First of all, you need to navigate to the directory in which you want to list files in File Explorer.

Step 2. Click on the address bar and type cmd in the file path and hit Enter, which will open the Command Prompt window.

Tips:

Also, you can locate the directory first in File Explorer, and then press the Win + R keys to open the Run box, type cmd in it, and hit Enter to open the Command Prompt window.

type cmd in the address bar of File Explorer

Step 3. In the pop-up window, you can list file CMD according to your needs. For example:

Example 1. CMD List all directories and folders under the current path.

dir

run dir in the cmd

Example 2. CMD List folders of the current directory only.

dir /ad

run dir ad

Example 3. CMD list files only under the directory.

dir /a-d

cmd list files only

Example 4. CMD list files and folders under a specific directory (e.g. C:Usersdefaultuser1)

cd C:Usersdefaultuser1

dir

CMD list files of a specific directory

Example 5. CMD list all system files under the directory.

dir /s

CMD list system files

Example 6. CMD list all read-only non-achieve files.

dir /a:r-a

CMD list read only files

Example 7. CMD list all files with the file extension .doc.

Tips:

You can replace the doc with other file extensions such as exe, png, xml, etc.

dir *.doc

CMD list files with doc extension

Example 8. CMD list all files with the file extension .doc and .jpg.

dir *.doc *.jpg

CMD list files with doc and jpg extension

Of course, there are many other dir commands to list file CMD on Windows 10/11 and we can’t explain all in this post. If you want to know more information about Windows CMD list files, you can search for corresponding commands online on Google.

Better Alternative to Command Prompt List Files

Although you can list files in a directory CMD, many professional commands might be unfamiliar to you. How to list all files/folders under a directory more easily? MiniTool Partition Wizard is a better alternative to Windows Command Prompt list files.

Its Space Analyzer feature can show all files/folders under a specific path in the file name, size, last change, extension, percentage of drive, etc. In addition, it tells you what files are taking up your disk space and helps you free up disk space.

MiniTool Partition Wizard FreeClick to Download100%Clean & Safe

list files using MiniTool Partition Wizard

About The Author

Position: Columnist

Ariel has been working as a highly professional computer-relevant technology editor at MiniTool for many years. She has a strong passion for researching all knowledge related to the computer’s disk, partition, and Windows OS. Up till now, she has finished thousands of articles covering a broad range of topics and helped lots of users fix various problems. She focuses on the fields of disk management, OS backup, and PDF editing and provides her readers with insightful and informative content.

  • SS64
  • CMD
  • How-to

Display a list of the applications currently installed on the computer.

Syntax
      WINGET [[-q] \query] [\options] [/?]

Arguments:

  -q,--query  The query used to search for an app.
  -?, --help  Get additional help on this command.

Options

   --accept-source-agreements  Use to accept the source license agreement, and avoid the prompt.
   --command     Filter results by command specified by the application.

   -e, --exact  Use the exact string in the list query, including checking for case-sensitivity.
                It will not use the default behavior of a substring.

   --header    Optional Windows-Package-Manager REST source HTTP header.
   --id        Limit the list to the ID of the application.
   --moniker   Limit the list to the moniker listed for the application.

   -n, --count  Limit the number of apps displayed in one query.
   --name       Limit the list to the name of the application.

   -s, --source  Restrict the list to the source name provided. Must be followed by the source name.
   --tag         Filter results by tags.
   --verbose-logs  Override the logging setting and create a verbose log.

The list command will show apps that were installed through the Windows Package Manager as well as apps that were installed by other means. The list command will also display if an update is available for an app, and you can use the upgrade command to update the app.

The list command also supports filters which can be used to limit your list query.

To list all apps with available updates use winget upgrade (without any arguments).

Examples

List a specific version of an application:

C:\> WINGET list —name git

List all application by ID from a specific source:

C:\> WINGET list —id Git.Git —source winget

Limits the output of list to 9 apps:

C:\> WINGET list -n 9

List the versions of ‘Terminal’, this will show if the application has an update available and will also list the available sources:

C:\> WINGET list terminal

If there are no updates available, list will only show you the currently installed version and the update column will not be displayed.

“I like all of the early relationship strips that were collected in ‘Love Is Hell,’ where I pretended to be an expert in relationships and did comics like ‘The Nine Types of Boyfriends,’ ‘Sixteen Ways to End a Relationship,’ ‘Twenty-Four Things Not to Say in Bed,’ and other arbitrarily numbered lists” ~ Matt Groening

Related commands

GitHub repository
WINGET — Discover, install, upgrade, remove and configure applications on Windows computers.
MSIEXEC — Microsoft Windows Installer.
WUAUCLT — Windows Update.


Copyright © 1999-2025 SS64.com
Some rights reserved

  • Use the “DIR” command to list files and folders in the current directory, or “DIR /S” to list files and folders recursively, in subdirectories as well.
  • To search for specific file types use the asterisk followed by the file extension type, in this syntax: DIR *.jpg
  • Use attribute switches to filter the type of files and folders to list.

It can be tricky to keep tabs on all files and folders on a Windows computer, especially if there are too many. There can be many folders and subfolders inside a partition, and many different types of file extensions. It can be difficult to view all the files and folders, or even search for specific ones using File Explorer.

Using the Command Prompt, you can view and list all sorts of files and folders inside a directory, and even its subdirectories using recursive switches. Not only that, but you can also list all items with a specific file type, or exclude them. Moreover, you can also view hidden items as well directly from the Command Prompt.

In this article, we give you a bunch of different examples to list files and folders inside the Command Prompt using the DIR cmdlet.

Command to List Files and Folders in Command Prompt

The DIR command is used to list files and folders inside a directory in Command Prompt. This command can be used with a number of switches and attributes to filter the items to display, their order or displaying, to include and exclude, and so on.

However, the only switches we will be interested in are /a and /s.

Using the DIR command alone will display all the files and folders inside that particular directory. It will not show any hidden items, and it will now show any items inside the subdirectories. However, if you use DIR /a, it will show the hidden items as well.

To perform a recursive search, we must use the /s switch.

The table below summarises the commands to use to list files and folders and these switches:

Command Description
DIR Display items inside the current directory
DIR /a Display all items inside the current directory, including hidden ones.
DIR /s List items inside the current directory as well as all subdirectories
Commands to list files and folders using Command Prompt

With that known, there is a list of attributes that you can use with the DIR /a cmdlet to filter the type of information you want to list. Here is a list of the attributes you can use with /a.

Attribute Alphabet Description Syntax Example
d Shows directories only DIR /ad
h Show hidden items only DIR /ah
s Show system files only DIR /as
l Show reparse points only DIR /al
r Show read-only files DIR /ar
a Show files that can be archived DIR /aa
i Show files whose content is not indexed DIR /ai
– (hyphen) Used before an attribute to exclude it from the list DIR /a-s (hide system files)
: (colon) To combine multiple attributes DIR /a:h-s (Show hidden items but hide system files)
Command Prompt syntaxes to list files and folders using attributes

Example Commands to List Files and Folders in Command Prompt

Let us now continue to see more extensive examples with images to better understand how you can list files and folders using the DIR cmdlet.

  • To list all files and folders in the current directory:

    DIR
    List files and folders in the current directory using Command Prompt

    List files and folders in the current directory using Command Prompt
  • To list all files and folders in the current directory and subdirectories:

    DIR /S
    List recursive files and folders in Command Prompt

    List recursive files and folders in Command Prompt
  • To list only folders in the current directory:

    DIR /AD
    List only folders in the current directory in Command Prompt

    List only folders in the current directory in Command Prompt
  • To list only folders in the current directory and subdirectories:

    DIR /AD /S
    List only folders in the current directory and subdirectories in Command Prompt

    List only folders in the current directory and subdirectories in Command Prompt
  • To list all files in the current directory and exclude all folders:

    DIR /A-D
    List all files and exclude folders in current directory in Command Prompt

    List all files and exclude folders in the current directory in Command Prompt
  • To list all hidden system files in the current directory:

    DIR /ASH
    List all hidden system files in current directory in Command Prompt

    List all hidden system files in current directory in Command Prompt
  • To list all system files and exclude read-only files in the current directory and subdirectories:

    DIR /A:S-A /S
    List all system files and exclude read only files in the current directory and subdirectories using Command Prompt

    List all system files and exclude read-only files in the current directory and subdirectories using Command Prompt
  • To list all specific file type files in the current directory and subdirectories:

    Note: You can change the file type extension to list the files you are looking for.

    DIR *.txt
    List all files with a specific file type using Command Prompt

    List all files with a specific file type using Command Prompt
  • To list multiple file types in the current directory and subdirectories:

    DIR *.txt *.doc *.docx /S
    List multiple file types in the current directory and subdirectories from Command Prompt

    List multiple file types in the current directory and subdirectories from Command Prompt

There can be many different examples and syntaxes to list files and folders inside the Command Prompt. However, we hope that the examples above are sufficient so that you can combine and modify them as per your requirements.

Closing Words

The Windows command line offers much more control over the fetched data than its GUI. Using the Command Prompt, you can list different files and folders inside the current directory as well as its subdirectories. You can also filter out the type of files and folders to include, or exclude from the list.

In this tutorial, you will learn how to list files, folders, and subfolders using Windows CMD commands and PowerShell.

I’ll also demonstrate using the NTFS Permissions Tool, which is a graphical program that displays the permissions on folders and subfolders.

In this article

  • List Files and Folders using the DIR Command
  • Display Folder Structure using TREE Command
  • Powershell List Folders and Subfolders
  • Get Folder and Subfolder NTFS Permissions

Check it out.

List Files and folders using the DIR Command

The dir command is built into all versions of Windows. It is an easy to use command to list files, folders, and subfolders from the Windows command prompt.

Let’s look at some examples.

Example 1. List files and folders in the current directory

To list the files and folders in the current directory, open the Windows command prompt, enter dir and press enter. The dir command by default does not display subfolders.

dir

In this example, my current location is c:\it, so when I run the dir command it will list everything in this folder.

cmd list folders

I have put the command output into colored boxes to explain what each column means.

  • Red = This column is the last modified date of the file or folder
  • Green = Indicates if the item is a folder, folders are labeled with DIR
  • Purple = The size of the file
  • Yellow = Name of the file or folder.

Example 2. List subfolders

Use the /s option to include subfolders.

dir /s

I ran the command from the c:\it location and it lists all subfolders and files from this directory. I’ve highlighted some of the subfolders in the screenshot below.

cmd list folder and subfolders

Example 3. Specify a directory path

To list files and folders from a specific directory enter the complete directory path.

dir /s c:\it

For example, if my current location is the root of c: and I type dir /s c:\it the command will display the items from the c:\it directory.

Example 4. Export list of files and folders

To export the screen output use the command below. You can name the file whatever you want, in this example, I named the file files2.txt

dir > files2.txt

The file will be saved to the current directory.

Pretty easy right?

I covered some of the most basic dir command options. To see a full list of options type dir /? and press enter.

To learn more about the dir command check out the Microsoft dir documentation page.

Display Folder Structure using TREE Command

The tree command is another built-in Windows command. This command will display the contents of a directory in a tree structure. This can be useful to give you an overview of the folder layout.

You must specify a path or this command will start at the root of c

Example 1. List all folders and subfolders using TREE

To list all folders and subfolders enter the tree command and the path.

tree c:\it\toolkit

Example 2. List all folders and files using TREE

To include files with the tree command use the /f option.

tree c:\it\toolkit /f

In my experience, I never use the tree command. I find it more useful when a command provides more details like modified dates, permissions, ownership, and so on. If you just need to see the files and folders with no other details then this is a great option.

Powershell List Folders and Subfolders

You can use the Get-Childitem PowerShell cmdlet to list files and folders. The Get-Childitem cmdlet is similar to dir but much more Powerful.

Let’s look at some examples

Example 1. List files and folders using Get-Childitem

This example gets the folder contents from a specific directory

Get-ChildItem -path c:\it\toolkit
powershell get list of folders

By default, the Get-ChildItem cmdlet lists the mode, LastWriteTime, Length, and Name of the filer or folder.

The mode can be the following:

  • l = Link
  • d – directory
  • a = archive
  • r = read-only
  • h = hidden
  • s = system

Example 2. Get subfolders using Get-ChildItem

Use the -Recurse option to get subfolders and files.

Get-ChildItem -path c:\it\toolkit -Recurse
powershell list files and folders

Example 3. Get items using the Depth parameter

You can use the -Depth parameter to control how many subfolders deep to include in the list.

Get-ChildItem -Path C:\it -Depth 2

Example 4. PowerShell List only specific file types

In this example, I will list only files that end in a .msi file extension. This will search all subfolders in the directory path.

get-childitem -path c:\it -include *.msi -recurse

Example 5. PowerShell List only folder or files name

The -Name parameter will only return the file or folder name.

Get-ChildItem -path c:\it\toolkit -Name

Example 6. PowerShell List all Files and Folder Details

To display all details of a file or folder use the fl option.

Get-ChildItem -path c:\it\toolkit | FL

You can see below this command will display additional details, if there are any.

Example 7. PowerShell count files and folders

To get a count of the files and folders use the measure-object option.

Get-ChildItem -path c:\it\toolkit | Measure-Object
powershell count folders

Example 8. Powershell Get Folder Size

You can also use the measure-object option to get the folder size.

Get-ChildItem -path c:\it\toolkit | Measure-Object -Property Length -sum
powershell get folder size

As you can see using PowerShell there are a lot of options when it comes to getting files and folders, you can create some really powerful reports.

Check out the Get-ChildItem documentation page to learn more.

Get Folder and Subfolder NTFS Permissions

If you need a report of folders and subfolders that includes who has permission to what, then check out the NTFS Permissions Reporting Tool below.

Example 1. List NTFS Permissions on Shared Folder

You can try this tool for FREE, click here to download it.

In this example, I’ll get the permissions on the shared folder \\srv-vm1\share

The NTFS Report will display the following:

  • DirectoryName = Path of the folder
  • Account = Account listed on the folder (this can be a user or group)
  • DirectoryOwner = Owner listed on the folder
  • DirectoryRights = Permissions the user or group has to the folder
  • Type = Allow or Deny
  • AppliesTo = What the permissions applies to
  • IsInherited = Are the permissions inherited from a parent folder

Example 2. List Folder Permissions on Local Folder

If you want to check the permissions on a local folder click the browse button or enter the folder path.

Which Command Will You Use?

In this article, I showed you three different commands to get files, folders, and subfolders.

I use the dir command for basic stuff and use Get-Childitem for more advanced searches.

Which command did you find most useful? Let me know in the comments below.

Related Articles

  • PowerShell get NTFS Permissions
  • Windows list open files
  • 10 Windows File Share Best Practices

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Что делать если компьютер не видит второй монитор windows 10
  • Как отключить onedrive windows 10 pro
  • Как дезактивировать windows 10
  • Как изменить раскладку клавиатуры windows 10 при загрузке по умолчанию
  • Windows 10 2015 iso download