You can list all files and directories in the Command Prompt (CMD) using the dir
command.
dir
This particular example will list all files and subdirectories in the current directory.
Note: The dir
command provides detailed information about each file and subdirectory, including their names, sizes, and last modified dates.
The following example shows how to use this syntax in practice.
Example: List All Files and Directories
Suppose that we want to view the contents of the following directory:
C:\Users\admin\Documents\cmd_script
We can type the following command to view the contents of the directory:
dir C:\Users\admin\Documents\cmd_script
The following screenshot shows how to use this syntax in practice:
We can see that the contents of C:\Users\admin\Documents\cmd_script are listed, including all files and subdirectories.
Conclusion
We can use the dir command followed by the path to view the contents of any directory on the system.
You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.