| Command | For | Command | For |
|---|---|---|---|
| Attrib | Amending File Attributes | Del | Deleting Files |
| Dir | Listing Directories & Finding Files | Extract | Extracting Files from Floppies/CDs |
| Format | Formatting Disks or Drives | Mscdex | CD-ROM Access |
| MD | Making (Creating) Directories | Ren | Renaming Files |
| Regedit | Importing & Exporting Registry | Scandisk | Scanning Disks for Errors |
| XCopy | Copying Files in DOS Mode | Win | Launching Windows from DOS |
| Using DOS Commands Further Commands Main Topic Index | |||
| ATTRIB - Changes the Attributes of Files. | ||||
|---|---|---|---|---|
Usage:ATTRIB switches filenameSwitches:
ATTRIB -r -a -s -h C:\WINDOWS\SYSTEM.DAT removes the Read-only, Archive, System and Hidden attributes.ATTRIB +R CONFIG.SYS makes Config.sys a Read-only file (eg to prevent tampering by casual users).ATTRIB +H +R D:\DOCS\*.DOC /S makes all *.doc files in the directory D:\DOCS and any sub-directories Hidden and Read-only.Note: DOS cannot remove all Win9x files from a hard drive by simply removing all System and Hidden attributes and then deleting them. It will decline to delete certain key files, which is why a FORMAT may be necesssary to clear a drive before a Windows re-install. |
||||
| DEL - Deletes Files. | ||||
Usage:DEL path+name switchSwitch: /P asks before deleting each file.Examples: DEL C:\BACKUP.OLD deletes the specified file.DEL C:\TESTS\*.* /P deletes all files in the C:\TESTS\ directory and asks before deleting each one.
|
||||
| Top of Page Main Topic Index | ||||
| DIR - Lists the contents of a Directory & finds Files. | ||
|---|---|---|
Usage:DIR /switchesDIR c:\directory\sub-directory /switchesDIR filename /switchesSwitches:
DIR C:\GAMES\TENNIS >PRN will give a printout of the specified directory, in no particular order.DIR C:\GAMES\TENNIS >C:\TENNIS.TXT will save a listing of the specified directory as above, in a text file. This can be read and edited using any text editor (including the DOS one), and printed later if required.DIR /O:-GN /A-H-S /S /V /P means
'Sort by Name grouping Directories last, exclude Hidden and System files, list the current Directory and Sub-directories, give All details, and Pause between Pages.'DIR C:\WINDOWS /O:N /A-D /S /4 >PRN means 'Print a list of the C:\WINDOWS and Sub-directory files, Sorted by Name, omitting extra Directory names, use 4-digit Dates (see note)'. - a useful combination for printing.DIR COMMAND.COM /S will look for COMMAND.COM in the current and all sub-directories, and list it as many times as it occurs.D:\PICS\>DIR *.JPG /ON /S >C:\PICS.TXT will look for files with the JPG extension in D:\PICS\ and sub-directories, list them in name order (by directory) and save the listing as C:\PICS.TXT.
|
||
| Top of Page Main Topic Index |
| EXTRACT - Extracts compressed files from a floppy disk or CD. |
|---|
Usage:EXTRACT switches [Location+Filename] [Destination+Filename]Switches:
EXTRACT A:\MAIN\VITAL.DL_ C:\WINDOWS\SYSTEM\VITAL.DLLThis is useful for a repair, involving a known missing or corrupt file, which cannot be done while Windows is running. You must know the location (pathname) of the good version and where it is to go. In this example, the file Vital.dl_ on floppy drive A: is specified and extracted from its compressed state to the correct directory with the full extension name. All files on installation CDs and floppies which have a ' _ ' as their last letter must be Extracted, not just copied across and renamed.EXTRACT /D D:\WIN95\win95_02.cab |MORE Displays a list of the contents of the 'Cabinet' file on the Win95 CD. Useful if you have not got a Cab File Viewer or WinZip (whose current version handles '*.cab' files like zipped ones and can Extract individual files).EXTRACT /A /D D:\WIN98\base4.cab >C:\cablist.txt Lists the contents of all the 'Cab' files on the Win98SE CD in a file called cablist.txt. This is quicker and more accurate than collecting lists from elsewhere as it lists your particular CD version. The file will be large, so open it with a Word Processor to do a search for a particular file you wish to Extract. Specify the first 'Cab' file in the \Win9x folder on your CD.EXTRACT /Y D:\WIN95\win95_02.cab\HYPERTRM.DLL /L C:\PROGR~1\ACCESS~1\HYPERT~1 Extracts the original version of HYPERTRM.DLL to its correct location and overwrites the existing version without prompting. |
| Top of Page Main Topic Index |
| FORMAT - Formats a floppy or hard disk drive for use by the Operating System. |
|---|
Usage:FORMAT x: /switches where 'x' is the letter of the drive to be formatted.Switches:
FORMAT D: /U /C /V:Dataformats drive D: Unconditionally, tests any Clusters marked as bad, and gives it the name 'Data'. There are more switches for specific types of floppy disk. (Type format /? to see the full list). DOS assumes a standard floppy drive will use the standard 1.4Mb size, so these are only required if a non-standard disk is being formatted. In the case of a hard drive (or the specified partition on a partitioned drive) DOS will automatically detect the size.FORMAT must be run after FDISK. It does not itself have the ability to partition a hard drive, or distinguish between FAT16 and FAT32. This is irrelevent for a floppy, but for a hard drive use FDISK or 'Partition Magic' first to specify the FAT and partitions. Security: Note that formatting a floppy or hard disk, with or without the /U switch, does not mean the data will be gone forever. Utilities exist which can retrieve it, so don't pass on old floppies or hard drives you've formatted thinking your private files cannot be read.
|
| Top of Page Main Topic Index |
| MSCDEX - Enables DOS Mode access to a CD-ROM. |
|---|
Usage:MSCDEX /D:x /L:y /other switchesSwitches:
C:\Windows\Dosstart.bat or a Boot Disk's Autoexec.bat (see Guide to Re-Installing Win9x). It must also have the CD-ROM's DOS mode driver pre-loaded, which is not possible from the DOS prompt, only by a line in Config.sys.Example: MSCDEX /D:MSCD001 /L:D /V loads MSCDEX, allocates the CD-ROM drive the letter 'D' and the device name 'MSCD001', and tells MSCDEX to load in verbose mode (ie say what is happening). |
| Top of Page Main Topic Index |
| MD - Creates a Directory. |
Usage:MD path+nameExamples: MD D:\DATA creates a new directory.MD D:\DATA\DOWNLOAD creates a new Sub-directory.
You cannot create a Sub-directory until the main directory exists. |
| Top of Page Main Topic Index |
| REGEDIT - Imports and exports Registry files. |
|---|
|
See Compacting Registry and Reg.bat Usage: REGEDIT switches filenameSwitches:
REGEDIT /E C:\EXPORT1.REG specifies the file to use when Exporting Registry (making a copy).REGEDIT /C C:\EXPORT1.REG specifies the file to use to Create (or rebuild) Registry. |
| REN - Renames a File or Directory. |
Usage:REN path+name nameExamples: REN C:\WINDOWS\SYSTEM.BAK SYSTEM.BA1 renames the file in the same directory.REN D:\DATA\DOWNLOAD MISC renames the D:\DATA\DOWNLOAD directory to D:\DATA\MISC.Do not enter the full path for the name the file or directory is to be renamed to. |
| Top of Page Main Topic Index |
| SCANDISK - checks a drive for errors. |
|---|
Usage:scandisk drive switchesSwitches:
SCANDISK tells Scandisk to check the current drive, using the default settings in SCANDISK.INI.SCANDISK C: /CUSTOM tells Scandisk to check drive C: with the Custom options specified in SCANDISK.INI.SCANDISK D: /SURFACE tells Scandisk to check drive D: for normal errors and then run a surface check.SCANDISK /ALL /AUTOFIX /NOSAVE tells Scandisk to check all drives on the hard disk, fix errors without asking, and not to save any lost cluster fragments it may find.C:\Windows\Command\Scandisk.ini: Open this file in the DOS Editor and have a look at the Default settings used by Scandisk. You may wish to change them. My preference is to tell it to 'Fix' most things, Delete Lost Clusters, and not to try to save any fragments to file. (The chances of being able to recover anything of significance from such files were always slight; they are slimmer than ever with things like Word 7/8 containing tons of rubbish not relevent to a particular document anyway!) If you do edit the file, run Scandisk with the /CUSTOM switch.Scandisk is a useful tool to have on a Boot Disk, to enable you to check the state of a Hard Disk and correct any errors. If a drive is suffering or won't boot, running Scandisk may solve the problem. The same applies where Windows' Disk Defragmenter (Defrag) fails to work and Scandisk under Windows fails to complete. Running Scandisk from DOS may cure the fault ... but that's not a promise! |
| Top of Page Main Topic Index |
| XCOPY - Copying Files in DOS Mode. |
|---|
Warning: In DOS mode XCOPY generates truncated (short) directory and filenames (see Long File Names). Try to stick to directories and files which conform to the DOS '8.3' standard. If you are not sure if a directory or filename name will be altered, use the DIR command to get a listing first.One can use the plain COPY command, but as it is not as good I am ignoring it.Usage: xcopy path+name path+name switchesSwitches:
XCOPY C:\MYDOCU~1\*.* C:\BACKUPS\*.* /E /P /Vcopies the files in the ' C:\My Documents\' directory and sub-directories to another directory, asks if you wish to copy each file in turn, and ensures it has done so correctly.XCOPY C:\WINDOWS\SYSTEM.DAT C:\BACKUPS\SYSTEM.BAK /Vcopies the file to another directory with a different name and ensures it has done so correctly. (Note: XCOPY will only copy a Hidden/System file if the Attributes have been temporarily removed first using ATTRIB).
|
| Top of Page Main Topic Index |
| WIN - Starts Windows from the DOS Prompt. |
Usage:WIN
|
| Top of Page Main Topic Index |
< Home >