Use "dir" command in Windows cmd for listing files

How can I list files in Windows using the command prompt (cmd)? I tried using ls on Windows like in Linux, but it gives an error.

Hello Keerti,

Using dir Command: The dir command is used to list files and directories in the current directory. It provides various options to customize the output.

dir

Hey Keerti,

Using dir Command with Wildcards: You can use wildcards (* for zero or more characters, ? for a single character) with the dir command to filter files.

dir *.txt // List all .txt files

Dear Keerti,

Using dir Command with /s Option: The /s option with the dir command lists files in the current directory and all subdirectories.

dir /s