To list files in Windows using the Command Prompt (cmd), use the dir
command. Open Command Prompt and navigate to the desired directory using the cd
command, then type:
bash
dir
This will display a list of files and subdirectories in the current folder. To view specific details, use options like:
/p
: Pause after each screen of output./w
: Display in wide format.
For example:
bash
dir /p
To list files in a specific directory:
bash
dir C:\path\to\directory
For only files of a certain type (e.g., .txt
), use:
bash
dir *.txt