Site icon TestingDocs.com

MS-DOS DIRECTORY Command

Overview

In this tutorial, we will learn about the MS-DOS directory command.  The directory command is dir. The MS-DOS directory command displays the list of files and subfolders (subdirectories) in the current or specified directory.

MS-DOS Directory Command

The directory command displays the contents of the directory. It lists the files, sub-directories, and other information in a directory or folder. The directory command is like a table of contents in a book.

Syntax

The basic syntax for the directory command is as follows:

\> dir [drive:][path][filename] [/A[:attributes]] options

Square brackets [ ] indicate optional parameters and : (colon) indicates that an additional value can be provided in the command.

Examples

This example will list all the files and subdirectories in the current directory. The steps to follow are:

\> dir

 

This directory will list the following information:

 

The list of files will scroll up and off the screen. The summary of the files and directories is displayed at the end of the listing. A line that shows the number of bytes free on the hard drive.

Search Files

To search for files with a particular pattern, you can use wildcards. For example,

\> dir *.exe

lists the executable files in the current directory.

 

 

To list files with a specific pattern. For example, to list files and sub-directories that start with the letter ‘w’.

\> dir w*

 

Pagination

The /p option with the dir command in MS-DOS pauses after each screenful of information. It allows you to review the contents page by page and press a key (often the spacebar) to continue viewing the next page.

\> dir /p

 

Wide list format

The /w option is used to display a wide list format. It displays the files and directories in a more compact, horizontally aligned format, making it easy for more entries on a single line.

/> dir /w

More information on the MS-DOS commands:

https://en.wikipedia.org/wiki/List_of_DOS_commands

Exit mobile version