0% found this document useful (0 votes)
75 views

DOS Commands: Attrib Attrib - R - A - S - H

This document provides examples of common DOS commands and their usage, including: - ATTRIB to change file attributes like read only, archive, etc. - CD to change directories and view folder contents - CLS to clear the screen - DEL to delete files - DIR to display files and folders - EDIT to open and edit files - HELP to get information on commands - MD and RD to make and remove directories - RENAME to change a file name - TYPE to view file contents - > to redirect command output to a file

Uploaded by

Hemant Pant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

DOS Commands: Attrib Attrib - R - A - S - H

This document provides examples of common DOS commands and their usage, including: - ATTRIB to change file attributes like read only, archive, etc. - CD to change directories and view folder contents - CLS to clear the screen - DEL to delete files - DIR to display files and folders - EDIT to open and edit files - HELP to get information on commands - MD and RD to make and remove directories - RENAME to change a file name - TYPE to view file contents - > to redirect command output to a file

Uploaded by

Hemant Pant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

DOS commands

Command and Usage Examples

ATTRIB
ATTRIB -R -A -S -H <VIRUS.EXE>
Change file attributes. '+' adds an attribute, '-'
All these attributes will be removed from
removes it. Attributes are: A=archive; R=read only;
virus.exe.
S=system; H=hidden.

C:
C:
Go to the C: drive. Similarly A: and D: etc.

CD\ takes you to the top of the directory


tree (typically to C:) .
CD.. moves you one level up the
CD directory tree (i.e. up towards the root
Change directory. When you change directory).
directory, the prompt changes, showing the CD <DIRECTORYNAME> takes you to
path of the directory you are currently in. that directory. You can use one or more
Note, directory is the term used by DOS for subdirectory names, separated by \ e.g. 
what Windows calls a folder. CD WINNT\Media takes you to the
directory C:\WINNT\Media
To change to another path, type the full
path with slashes. e.g. 
CD \WINDOWS\SYSTEM
CLS CLS
Clear the screen.

DEL DEL <VIRUS.EXE> deletes virus.exe


Delete one or more files in the current directory. Can DEL *.JPG will delete all files with the
be used with the '*' and the '?' wildcards. extension JPG.
DEL *.* will delete ALL files in the current DEL MY*.* will delete all files beginning with
directory, USE WITH CAUTION. MY and with any extension.
(Note: DEL cannot be used to delete directories. Use DEL MY??.* will delete files that are 4
RD to remove a directory.) characters long and begin with MY and with any
extension.

DIR DIR displays all files and folders in the current


Displays the contents of a directory (folder). directory. Folders are indicated in the list by
Note, directory is the term used by DOS for what <DIR>.
Windows calls a folder. Files are usually listed by name.
DIR /P displays the contents a page at a
These switches can be combined, so DIR time, i.e. as many as will fit in your command line
/W /P will return multiple rows listing a page at a window. Press any key to display the next page.
time. DIR /W displays the files/folders in multiple
You can use the '*' and the '?' wildcards to search for rows. This view gives less information per file.
a particular file. The ? character represents ONE DIR *.JPG displays all files with the
character, and the * character represents multiple extension JPG in the current directory and all
characters.
subdirectories.
DIR MY??.* displays all files beginning with
MY, exactly 4 characters long, and with any
DIR *.* lists all the files in a directory. extension.
DIR /S lists the contents of all subdirectories.
DIR /AH displays all hidden files.

EDIT EDIT <VIRUSLOG.TXT> opens the file


Runs DOS EDIT (a simple text editor). Useful for viruslog.txt and allows you to edit it.
editing batch files and viewing logs. This command EDIT <NEWFILE.TXT> creates a new file
requires QBASIC.EXE to be present. called newfile.txt and opens it up for you to edit.

HELP
Displays DOS Help. For help on an individual HELP DIR displays information on the DIR
command, type HELP then the command for which command.
you want more information.

MD
Make directory. Creates a new directory below the MD <NEWDIR> creates a new directory called
current one. (The command can also be written Newdir.
as MKDIR)

PRINT PRINT <LOGFILE.TXT>


Prints the specified file (if the printer is supported in Prints LOGFILE.TXT
DOS - many are not).

RD
Remove directory. Removes a subdirectory of the
current directory. The directory you want to remove RD <DIRECTORYNAME>
must be empty of all files. (The command can also be
written as RMDIR)

RENAME RENAME <OLDNAME.EXE>


Rename a file. You must use the full file name
<NEWNAME.EXE>
including the suffix.

TYPE
Displays the contents of a file on the screen. If you
use this command on a file which is not a text file, the TYPE C:\README.TXT|MORE
display will be unintelligible. Use with "|MORE" to
display the text on a page by page basis, and prevent
it scrolling off the screen. "|" is a pipe character.

>
When you run a DOS command, output is usually COMMAND > FILENAME.TXT
sent to the screen. Use > to redirect output from the e.g. SWEEP > REPORT.TXT The details of any
screen to a file. It runs the command preceding the >, infected files reported by SWEEP are sent to a
creates a file in the current directory with the name file called REPORT.TXT.
you specify, and sends the information/output
returned by the command, to that file.

You might also like