If you are a regular Windows 10 user, then you must be familiar with many of the commands that you can use in order to perform various activities in Windows 10. Similarly, Dir is also a Windows Command Prompt command, which is there to list the folders, sub-folders, and files present in the current directory. In this article, we will explain to you the method through which you can use the Dir command in Windows 10.
Windows Dir Command
In order to use the Dir command in Windows 10, you will need to perform the following steps:
Type cmd in the search section of your taskbar and click on the search result to launch the command prompt window. The newly opened Command Prompt window is shown in the following image:
The Dir command can be used in conjunction with multiple different switches. Therefore, we will discuss all of those switches one by one. First, we will learn how to use the Dir command without any switches. For doing that, type
dir
in your command prompt window and then press the enter key. This command is also highlighted in the image shown below:
As soon as you will press the enter key, you will notice that a list of all the folders and sub-folders present in your current directory will be displayed on your Command Prompt window as shown in the following image:
In order to display all the directories in your current path, type
dir /ad
in your Command Prompt window and then press the enter key. As soon as you will press the enter key, you will see the results displayed in the image below:
If you just want to display the read-only files in your current path, then type
dir /ar
in your Command Prompt window and then press the enter key. The results of this command are displayed in the following image:
In order to view the hidden files in your current path, type the command,
dir /ah
in your Command Prompt window and then press the enter key. Running this command will display the results shown in the image below:
If you want to view the Ready to Archive files in your current path, then type the command,
dir /aa
in your Command Prompt window and then press the enter key. The results of this command are shown in the following image:
In order to view the system files, type the command
dir /as
in your Command Prompt window and then press the enter key. This command will display the results shown in the image below:
If you want to view the files that are not content indexed, then type the command,
dir /ai
in your Command Prompt window and then press the enter key. The results of this command are shown in the following image:
In order to view the Reparse Points, type the command,
dir /al
in your Command Prompt window and then press the enter key. This command will show all the reparse points as shown in the image below:
You can also use multiple switches in one single command. For example, you can combine the switches, ‘s' and ‘h' in order to view the system and hidden files together by typing the command,
dir /ash
in your Command Prompt window and then pressing the enter key. The results of this command are shown in the following image:
Moreover, you can also exclude the results of one switch from another. For example, you can use the command,
dir /a-d
in order to view no directories in your search results as shown in the image below:
If you only want to see the file names without any extra attributes such as the file size and time stamps in your search results, then type the command,
dir /b
in your command prompt window and then press the enter key. The results this command are shown in the following image:
In order to view the results of the dir command in the form of two or more columns instead of one, type the command,
dir /D
in your Command Prompt window and then press the enter key. Running this command will display the Dir results in multiple columns as shown in the image below:
If you want to view the names of all the directories, sub-directories and files within the current directory in lower case letters, then type the command,
dir /L
in your Command Prompt window and then press the enter key. The results of this command are shown in the following image:
In order to view the file names at the extreme left of your Command Prompt window, type the command,
dir /-N
in your Command Prompt window and then press the enter key. As soon as you will do this, the file names will be displayed at the extreme left of your Command Prompt window instead of right as shown in the image below:
You can also sort the dir results by using the /O switch. For example, if you want to sort the files in the ascending order of their sizes, then type the command,
dir /OS
in your Command Prompt window and then press the enter key. The sorted results of the Dir command are shown in the following image:
In order to view the metadata of every file present in your current directory, type the command,
dir /Q
in your Command Prompt window and then press the enter key. The results of this command are shown in the image below:
If you want to see the Dir results in a wide format, then type the command,
dir /W
in your Command Prompt window and then press the enter key as shown in the following image:
In order to view the short names of the files, type the command,
dir /X
in your Command Prompt window and then press the enter key. The results of this command are shown in the image below:
If you want to seek any help regarding the Dir command and its switches, then type the command,
dir /?
in your Command Prompt window and then press the enter key. The description of various switches of the Dir command will be displayed on your Command Prompt window as shown in the following image:
Conclusion
By following the various steps mentioned in this article, you can easily use the Dir command in Windows 10 and view its results right according to your needs and choice by using different types of switches.