Directory Commands

 

DIR

Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename] Specifies drive, directory, and/or files to list.

 

dir

Lists all files and directories in the directory that you are currently in.

dir /ad

List only the directories in the current directory. If you need to move into one of the directories

listed use the cd command.

dir /s

Lists the files in the directory that you are in and all sub directories after that directory, if you are at root “C:\>” and type this command this will list to you every file and directory on the C: drive of the computer.

dir /p

If the directory has a lot of files and you cannot read all the files as they scroll by, you can use this command and it will display all files one page at a time.

dir /w

If you don’t need the info on the date / time and other information on the files, you can use this command to list just the files and directories going horizontally, taking as little as space needed.

dir /s /w /p

This would list all the files and directories in the current directory and the sub directories after that, in wide format and one page at a time.

dir /on

List the files in alphabetical order by the names of the files.

dir /o-n

List the files in reverse alphabetical order by the names of the files.

dir \ /s |find “i” |more

A nice command to list all directories on the hard drive, one screen page at a time, and see the number of files in each directory and the amount of space each occupies.

dir > myfile.txt

Takes the output of dir and re-routes it to the file myfile.txt instead of outputting it to the screen.

MD

Allows you to create your own directories in MS-DOS

Syntax

Creates a directory.

MKDIR [drive:]path
MD [drive:]path

Examples

md test

The above example creates the “test” directory in the directory you are currently in.

md c:\test

Create the “test” directory in the c:\ directory.

 

CD

Change current directory. Displays the current working directory when used without a path parameter.

cd displays the current working directory on the current drive.

cd f: displays the current working directory on F:.

cd .. changes the working directory to the parent directory (up one directory level).

cd \ changes the working directory to the root (top level) directory of the current drive

 

RD

            Remove a directory which by default must be empty of files for the command to succeed (the/s flag removes this restriction).

rd [directory]

 

Tree

Shows the directory tree of the current directory.

Tree[options][directory] Options:

/F (displays the names of the files in each folder)

/A (Use to ASCII instead of the extended characters).

/? (Shows the help)

 

 

Path

Path is used to specify the location where MS-DOS looks when using a command. For example, when using the command “format”, if the path is not specified to where the command is you will receive bad command or file name.

Syntax

Displays or sets a search path for executable files.

PATH [[drive:]path[;...]] PATH ;

Type PATH ; to clear all search-path settings and direct Windows to search
only in the current directory.
Type PATH without parameters to display the current path.

Examples

path=c:\windows\command

This is where a lot of DOS commands are stored in Window 95; if you are not able to do a dos command, type this command in, allowing all commands you type in, such as “deltree”, to be loaded from this directory. However, if you have another file in another directory such as C:\DOS it will no longer look there.

 

 

Registration


A password will be e-mailed to you.

Feedback Form

Name (required)

Email (required)

Feedback