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 theconfig.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 line:
DEVICE=c:\cd-rom\cdrom.sys /d:CD001
(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 line:
c:\windows\command\mscdex.exe /d:CD001
(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 sub-folders:
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:
PATH=c:\dos;c:\utils;
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:
PATH=%PATH%;c:\folder;
which will add the folder C:\folder to the existing PATH (%PATH%)
The 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 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 follows:
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.
Listing files
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:
o /ah: displays hidden files
o /ad: displays folders only
o /ar: displays read-only files
o /aa: displays files ready to be archived
o /as: displays system files
· To display files in a specific order:
o /ON: sorted by name
o /OS: sorted by size (ascending)
o /OE: sorted by extension
o /OD: sorted by date
o /OG: sorted by parent folder
o /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
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.
The command "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 file:
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).
No comments:
Post a Comment