The dir command is also aDOS command, available in all versions of MS-DOS.

The dir command is also included in theRecovery Consolein Windows XP.

The availability of certain dir command switches and other dir commandsyntaxmay differ from operating system to operating system.

Person using the dir command on Windows Command Prompt

Theresa Chiechi / Lifewire

Use this option to specify a sort order for the results.

When executed alone,/olists directories first, followed by files, both in alphabetical order.

SeeHow to Redirect Command Output to a Filefor more on how to do this.

dir help command in a Windows 10 Command Prompt

To seeallfiles and folders, you would execute dir c:\users /a (removing the h) instead.

However, theexactoutput you would have seen is instead located inside that text file.

The dir command is often used with thedel command.

Similar is thermdir /scommand, and olderdeltreecommand, used to delete folders and files.

As mentioned above, the dir command is also often used with aredirection operator.