Setting the CD-ROM drive
The CD-ROM drive is configured in the config.sys and autoexec.bat system
files. The CD-ROM drive device driver must be configured in the config.sys file (even if the device is
automatically detected in Windows). To do this, copy the device driver to a folder on the hard drive (in the following
example it is called cdrom.sys located in the "cd-rom" folder). Next you must add the
(CD001 is the name you give to the CD-ROM drive...)
Next the CD-ROM controller
(called mscdex.exe must be added to the autoexec.bat by adding the following
(Where CD001 is the name given to the CD-ROM drive and the drive letter that is assigned to the
drive is the next letter available, so if you have hard drives D: and E:, and F: is free, then the CD-ROM drive will be
assigned the letter F:. If you want to specify the letter to be assigned use the /L:Z option for example.)
Copying a file
There are to commands used to copy files in DOS: copy and xcopy.
Xcopy is the most useful, and
is uses the following syntax:
xcopy source destination (where "source" is the filename and "destination" is
the filename or folder name where the file is to be copied)
The entire contents of a folder can be
copied by typing the name of the folder for "source". The destination must therefore be the name of a folder, it would
be rather difficult to copy a folder (i.e. a group of files) into one single file!
The "/s" switch is used to copy
xcopy folder1 folder2 /s copirs folder1 to folder2.
Running a program from any folder
The "PATH" environment variable lets you set the folders whose contents may be accessed even if you
are working from a different folder.
Syntax is as follows:
The files located in the C:\dos and C:\utils folders may be executed regardless of which folder you are
working from. If you have already specified the folders in the environment variable and you wish to add another, you
can use the following command:
which will add the folder C:\folder to the existing PATH (%PATH%)
variable has a 127 character limit as the name of variable PATH and the equal sign take up 5 characters
already, there are only 122 characters left to specify the folder names
Tip to use this variable effectively make sure to:
- remove any spaces in the path command
- delete any rarely accessed folders
- give folders the shortest name possible
Mapping a folder to a drive letter
Mapping a folder to a virtual drive can be done using the subst command.
The syntax for the
command is as follows:
subst f: c:\example
The folder C:\example will then be accessible as a virtual drive with the letter "F:". This implies
that the F: drive is not already assigned to a drive, if so the system returns the error message "syntax error 10".
You must change the target drive letter...
Modifying file properties
A file may have several properties which dictate how that file can be used. These properties can
be activated or deactivated in DOS using the attib command.
The syntax for the command is as
attrib +/-a +/-h +/-s +/-r
where + and - activates or deactivates the attribute which follows.
- a: archive attribute
- h: hidden file attribute (the file remains hidden in normal file view)
- r: read-only file attribute (the file cannot be deleted without deactivating this attribute)
- s: system file attribute (important files which must be treated with care)
"attrib config.sys -a -r +h" deactivates archive and read-only attributes and hides the file.
The dir command is used to list files. The file listing can also be done using several
criteria (alphabetical order, date, etc.), these criteria can be applied using the following parameters:
- /p: fills the screen with the results then pauses the screen
- /w: displays the results in 5 columns
- To display files according to various criteria:
- /ah: displays hidden files
- /ad: displays folders only
- /ar: displays read-only files
- /aa: displays files ready to be archived
- /as: displays system files
- To display files in a specific order:
- /ON: sorted by name
- /OS: sorted by size (ascending)
- /OE: sorted by extension
- /OD: sorted by date
- /OG: sorted by parent folder
- /OS: sorted by attribute
- /s: displays the files located in a folder and all sub-folders
- /b: minimal view
- /l: displays results in lowercase
- /v: displays additional information
Using wildcard characters
For a command that runs on files, instead of giving a file name you can use the wildcard
characters when specifying files whose name begins with certain characters:
- the wildcard character "*" replaces parts of a name or an extension
- the wildcard character "?" replaces a character (like the blank tile in scrabble)
Thus the command "dir *.com" lists all files with the .com extension.
"dir b*.*" returns all files whose name begins with b.
How to send the displayed results to a file
Using the redirect parameter (> or >>) you can send the results of a dir command to a
The "dir >> test.txt" will send the list results to the test.txt file which will be created
in the current directory if it does not already exist, or if it does exist the new file name will be concatenated
(a number added to the end of the existing file).
Latest update on October 16, 2008 at 09:43 AM by Jeff.