External DOS Commands
Under Construction!

These are all of the DOS external commands
Note: Some are not available with every version of DOS!
APPEND ASSIGN ATTRIB BACKUP COMP CHKDSK DEFRAG
DELTREE DISKCOMP DISKCOPY DOSKEY DEBUG EDIT EDLIN
EXE2BIN FASTOPEN FC FDISK FIND FORMAT GRAFTABL
GRAPHICS JOIN KEYB LABEL LINK MEM MODE
MORE MOVE NLSFUNC PRINT RECOVER REPLACE RESTORE
SCANDISK SELECT SETVER SHARE SMARTDRV SORT SUBST
TREE SYS XCOPY XCOPY32      











FDISK
FDISK is the DOS utility to low-level-format/partition your hard drive. For newbies, I would recommend staying away from fdisk until you fully understand hard disk partitions (Unless you are not worried about losing all the data on your hard disk). It is probably wise to learn-up on what a partition is if you don't already know. Click here for more about partitions. Then click the BACK button on the top of this page to continue.

FDISK is a straight forward program to use if you understand partitions. Here I will cover some tricky things that aren't straight forward when using FDISK. When you go to create a partition, fdisk will first ask you if you want to use all available space for the new partition. Remember, windoze95 A, DOS 6, and DOS 5 can't have any more than 2 Gigs for any single partition. FDISK will have "2048" as the default partition size (In Megabytes) even if you have more available space on your hard drive. If this value is ok, fdisk will automatically make your new partition and set it active. If you need to change the default size of your partition, you will have to go back and manually make it active. This is option 2 from the main menu in fdisk. Otherwise, your hard drive will not be bootable, even after you format and transfer the DOS system files to it with SYS. If you are just adding another hard disk to your system and you will NOT be booting from this drive, it isn't necessary to make your new partition active. And just for the record, you must format you partition after you create it.

Here are all switches FDISK will accept:

/STATUS this switch shows you current partition info without having to mess with FDISK

/X this switch makes FDISK ignore extended disk support if you are getting "disk access" or "stack overflow" error messages.

/MBR an undocumented function to re-write the Master Boot Record on your hard drive. The only down side is that I've heard it will sometimes re-write the partition table depending on whether it's intact. At this moment I don't know how it determines this, so be cautious. I have used this feature many times without any data loss though. It's also handy for cleaning out boot sector viruses; be careful with viruses that hide the original boot sector like the Stoned virus. If you have any third party boot loaders (LILO, System Commander, ect.) this will eradicate them and make any active DOS partition your default OS to boot to. A handy thing to remember. (I recently discovered that the FDISK/MBR option will not make your DOS partition your default boot partition to if it is not the first partition on your hard disk. Anyone with more info about why that is please send me a note! :-)

Note to all who use a version of DOS that predates DOS 5:

FDISK from versions of DOS before 5 do not accept any switches. They also report the disk size in cylinders, not megabytes. Also, as I mentioned earlier, the largest partition you can have is 33MB with these older versions of DOS.


FORMAT
FORMAT is used for- you guessed it- formatting disks. This is necessary so that DOS knows where to put data on a disk. FORMAT writes over every available sector on the disk, putting "place holders" where every bit can go. It also sets up the boot sector, root directory, and FAT. FORMAT also detects bad sectors on your disk and marks them out so DOS wont try to use them. FORMAT gives you a list of all it did after completion. If you see that it found bad sectors on a floppy disk, I would advise throwing it away. Floppies are so cheap you shouldn't risk using a diskette that is on its way out. Even if you don't consider your data very important, it can be a hassle to mess with bad floppies.

Just for the record, all of the following switches do their thing after a full format has been done, unless otherwise specified.

/S this copies system files to you disk after it's formatted (Makes the disk bootable)

/V [label] labels the disk with the name specified by [label]

/Q does a quick format- basically it just overwrites the FAT and root directory, does not check for bad sectors or overwrite the data section of the disk

/F: [size] lets you tell FORMAT what density to format the disk as. [size] can be any of the following: {160, 180, 320, 360, 720, 1.2, 1.44, 2.88} These values are in reference to how many kilobytes are on a disk- 160 is for a single sided 160K 5 1/4" disk, 1.2 is a HIGH density 1200K 5 1/4", 720 is a DOUBLE DENSITY 720K 3 1/2", ect. You can format a HIGH DENSITY 3 1/2" as a DOUBLE DENSITY 3 1/2" disk with this switch, if you ever need to.

Here is an undocumented switch for use with DOS 7.1's FORMAT (Windoze 95 B) that lets you specify the cluster size used on your hard disk (And possibly on a floppy):

/Z: n where n is the number of sectors per cluster

These switches are also undocumented by micro$oft. They are only found in FORMAT from DOS 5 and higher.

/AUTOTEST
/U
/SELECT
/BACKUP

Try these out and see what happens. Various combinations will make a floppy disk unusable, so experiment! I have found they do slightly different things between versions too (Specifically, /SELECT). It's also possible to create a divide overflow with FORMAT if you tell it to format with 999 tracks and around 50 sectors per track.

C:\>format a: /T:999 /N:50

An interesting note is that micro$oft has used the /AUTOTEST switch in a batchfile that comes with windoze 98. It is in a batchfile located in your C:\WINDOWS\COMMAND directory. I don't remember it's name, but it is used to make a startup diskette.


ATTRIB
ATTRIB is used to change a file or directories attribute bit. "What is that?" you might ask... A files attribute means more in UNIX environments than in DOS, but it is still important here. A files attribute has four possible settings: ARCHIVE, READ-ONLY, SYSTEM, and HIDDEN. Any combination of them together is possible. Switches ATTRIB accepts:

R stands for the READ-ONLY attribute
A stands for the ARCHIVE attribute
S stands for the SYSTEM attribute
H stands for the HIDDEN attribute
+ adds the selected attribute to the specified file
- removes the selected attribute from the selected file
/S performs the attribute change on all files in the directory you specify

What it all means! The READ-ONLY attribute protects a file so nothing can change it (Except the ATTRIB command). The ARCHIVE setting has no specific effect on the file itself, but was mainly used by hard disk backup programs. Most backup programs can be set to only backup files with their ARCHIVE bit set. The SYSTEM attribute is used on system files. These are special files that are needed for DOS (And windoze 95) to run. The SYSTEM attribute also makes a file hidden (But without the HIDDEN attribute being set). If you remove the SYSTEM attribute from the DOS kernel files in your root directory (MSDOS.SYS and IO.SYS in MSDOS or IBMBIO.SYS and IBMDOS.SYS for PCDOS) your computer will not boot up the next time you try to turn it on. I bet you can guess what the HIDDEN attribute does! Yep, makes files invisible to the DIR command. Note: the TYPE command see's right through hidden files.

How to use ATTRIB:

C:\>attrib -s -r -h C:\msdos.sys

This example removes the SYSTEM, READ-ONLY, and HIDDEN attributes from a file called MSDOS.SYS in the root directory. You could then alter MSDOS.SYS. (In windoze 95 MSDOS.SYS is a text file you can change options in, in DOS 6.22 and below MSDOS.SYS is a binary file that you wouldn't want to mess with- unless you are me!) To restore those attributes to MSDOS.SYS just change the "-" to a "+" in front of the attributes.

C:\>attrib +s +r +h C:\msdos.sys

Note: it does not matter in which order you change the attributes. In DOS 6 and up you must change all the attributes at once (Except for the ARCHIVE bit) or DOS will give you the following error message: "Not resetting system file C:\MSDOS.SYS" for any file with these attributes set. If the file doesn't have the SYSTEM bit set, it would give you "Not resetting hidden file C:\MSDOS.SYS". This is a never ending cycle unless you change the SYSTEM, READ-ONLY, and HIDDEN attributes all at once. Any DOS version below 6 will allow you to change just one attribute at a time if you so desired. Also, in DOS 3.3 and below, ATTRIB does NOT allow you to change the HIDDEN attribute in a file. You can make a file have the HIDDEN attribute if you are competent in DEBUG or a low level disk editor, but not with ATTRIB.


SYS
This command is used to make a boot disk. It copies IO.SYS, MSDOS.SYS, and COMMAND.COM to your boot disk. With older versions of DOS the diskette needed to be completely empty before you used the SYS command. That was because the system files (MSDOS.SYS and IO.SYS with Micro$oft's DOS; IBMBIO.COM and IBMDOS.COM for IBM's DOS) had to be the first 2 files on the disk. Since DOS 5 that isn't necessary anymore. You can also make a boot disk by using the "/S" option with FORMAT. Usage:

C:\>sys a: where a: is the drive you are "sys'ing"

One VERY important note, for SYS to work it must know where to find the system files. By default it looks on the current drive you are on (If you're on the C: drive, it looks to C:\ for the system files.) If the drive you are currently in does not have the system files, SYS may give you "Invalid function" or "Can not find system files". If your current drive doesn't have these files, you can tell SYS where to find them like so:

C:\>sys c:\ a: where "c:\" is the location of your system files, and "a:" is the drive you are wanting to make a boot disk in

Rather than trying to remember the second example, just be sure you always use SYS from your C: drive (As long as you boot off your C: drive!) One more note, you can't see the system files with just DIR, you need to use DIR /A/P or they will be invisible. (That's for windoze 95/98 users, for users of DOS 5 through 6.22, use DIR, -yes include the comma! If you have a DOS below 5, yer on yer own!)


EDIT
This is a DOS text editor included with DOS 5 and up. Except for the windoze 95/98 DOS, EDIT requires that you have QBASIC in the same directory or in the PATH. Here are the switches it accepts:


/B - Forces monochrome mode.
/H - Displays the maximum number of lines possible for your hardware.
/R - Load file('s) in read-only mode.
/S - Forces the use of short filenames.
/<nnn> - Load binary file('s), wrapping lines to <nnn> characters wide.
Wildcards and multiple file specs can be given.

Most of you can ignore all of these switches. I will tell you a little secret: I didn't even know EDIT accepted any switches until I wrote this section! Hmmmm, anyone out there ever used EDIT in place of DEBUG with /<nnn>? Normal usage of EDIT is as follows:

C:\>edit myfile.txt

Not to tough! Since EDIT has it's own online help, you should be able to figure out any other problems you may have once EDIT starts up. One last note: you can produce control characters by typing <CTRL+P> followed by any key that can make a control character (The ESCAPE KEY would make the escape character- for use in escape sequences.)


DELTREE
This nifty command was unveiled upon the arrival of DOS 5. Unlike it's counter part RD it can remove directories even when they still have files and subdirectories in them. Some consider this a very dangerous command, I just say make backups :-) It accepts a sole switch, "/Y". Normally DELTREE will ask you for conformation before it does its magic. The "/Y" switch prevents this.




















EXE2BIN
This is an oddball programmers utility MS used to include with DOS. All the texts I have read just say it converts an executable to a binary- I firmly believe that it takes an executable (File ending in .EXE) and converts it to a .COM program. Perhaps someone could straighten me out on this (I ain't a programmer- yet!) This in one of the FEW commands I can't help you guys out with. Sorry! I just ain't ever used it!




















GRAPHICS
This was supposed to allow you to print a graphics display to your printer. Unless you still dabble in 8088's and daisy wheel printers you can forget about this one. Anyone needing help with it email me at dosman33@hotmail.com and I'll help you.




















MORE
This a nicety to know how to use. It takes the output of another command, like DIR, and pauses the output one screen at a time. One bad thing- you can only go forwards through the text. Once the screen fills up with text it stops it and waits for you press the any key (Yes I said "the any key" ;-) Actually, you would be more likely to use MORE with TYPE rather than DIR. Say you want to do a quick read-over of a letter. Here is how to do it:

C:>type letter.txt | more

The "|" is the PIPE, it redirects the output of a command into the command on the right of it. MORE must be in your current directory or PATH for this to work. Note: MORE creates a temporary file when you use it. If you do not have an environment variable set that defines your TEMP directory MORE tries to make its temp file in your current directory. This becomes important if you try to use MORE while using write protected floppy. MORE will give you: "Intermediate file error during pipe" because a temp file cannot be created. You can un-write-protect your floppy or just set an environment variable like so:

C:\set temp=c:\windows\temp
You can change the variable to point to any drive or folder you want as long as it is not a read only drive.


SCANDISK
This was the update to CHKDSK. It was first released with DOS version 6. It does everything CHKDSK does plus a little. "HEY WAIT A MINUTE!, WHAT DOES CHKDSK DO?!" Ok ok ok, CHKDSK scanned the DOS file system for corruption. If files where deleted improperly, power shut down in the middle of a program, ect. These things can leave the file system in shambles. If you want to know more, see my DOS DEFINITIONS PAGE. "OK, WHAT IS IT THAT SCANDISK DOES THAT CHKDSK DOESN'T?" In short- the surface scan check. (Which most people don't do cuz it takes so long to do anyway!) The surface test writes data to every single *bit* of space on your disk (Floppy and hard disk.) That's why it takes to long. It is designed in a way so that you don't loose your data in the process (Unlike much older utilities- if you did a surface scan it was just like formatting your C: drive! I remember a program from ZDOS 3.3.2 that did this!) Also, FORMAT in effect does a surface scan also- but in a destructive manner. FORMAT will detect bad sectors too.











CHKDSK
This was the original "disk integrity" program. It checks your file system for improperly deleted files (Reported as "Lost chains") and other things. It was included with EVERY version of DOS, even in DOS 6 even though SCANDISK was available with DOS 6. Here's the switches it accepts:

/F automatically fixes any errors found
/V shows every file on your disk
















TREE
This little program shows the structure of your hard and floppy drives.




























APPEND
This utility is very similar to the PATH environment variable. If you don't know what the PATH does, I would learn about it first. When a program is run, it usually has every supporting program in the same directory with it. Example, Word Perfect 5.1 has some 80 files in its directory (Which does not include documents you have typed). These include the spell checking program, font files, and printer utilities ect. When Word Perfect is run, it expects to find all of these files in the same directory as itself. If some of these files are not there, it chokes and may exit to DOS or it may just give you an error message. Remember that the PATH allows DOS to find programs and commands that are not in your current directory. APPEND will allow Word Perfect to find its files even when they are not in its own directory.

ASSIGN
This utility was invented for the first computers with hard drives (Yea, a loooong time ago!). Back when all you had was a floppy drive (And these where 5 1/4" disks- the original floppies for PC's) programs would only install to drive A: and B:. If you were one of the lucky few to have a hard drive, you might be out of luck if you needed to install software on drive C:. ASSIGN changes your drive letter arrangement. It lets you make your C: drive become your A: or B: drive. Or any other combination you desire. It was included up through DOS version 5. Here's how to use it:

C:\assign x:=y: where x: is the drive letter to be reassigned; and y: is the drive x: will be assigned to
It accepts one switch, which tells you the current assigned drives:
C:\assign /status

Just typing ASSIGN by itself after you have already ASSIGNed a drive will undo the "ASSIGN". You can only assign one drive at a time. Example: you cant assign both the A: and B: drive to drive C: at the same time.

There is some fun to be had with ASSIGN. You can use SUBST to make a drive letter out of a subdirectory, and then "ASSIGN" it over your C: drive. Be careful, you can lock yourself out of your computer that way (Until the next reboot anyway). There are some other things you might be able to do also if you think about it :-)


SUBST
This included with every version of DOS, even Windoze 98. It lets you make a drive letter (Like "D:") out of a subdirectory. This is good for shortening your PATH statement, and also for making it easier to get to directories far down in your tree. Here is how to use it:

C:\subst x: y:\path where x: will be the new drive letter; and "y:\path" is the drive and directory you want to put at drive x:
There is one switch you can use with it:
C:\subst x: /D this undoes the substitution of drive "x:"

You can just type SUBST by itself to see all drives you currently have assigned. The only limit to how many drives you can SUBST is the amount of letters in the alphabet. Also you remember about the LASTDRIVE option used in your CONFIG.SYS file. Unless you set it in your CONFIG.SYS file, you wont be able to SUBST any drives after E:. Change it's value to any letter you want, up to Z:.


DISKCOMP
This util comes with all versions of DOS up to 6.22. It compares two diskettes to see if they are identical. It can't be used on hard drives. This was more important when an "acceptable number bad sectors" was allowed with floppy disks. Anymore, if you have a floppy with any bad sectors at all you should throw it away. Here's Johnny:

C:\diskcomp a: b: this is simple enough, it compares drive A: to B:

And here are the two switches you can use with it:
/1 only compares the first side of the disks
/8 only checks the first 8 sectors of each track

These switches are mostly for use if you have OLD OLD OLD 5 1/4" drives. Early floppies only used one side of the disk (160k and 180k of whopping space on these!). After these disks they started to use 9 tracks per sector to cram more on them. That's the only reason for these switches.

Now, I know those of you with only one floppy drive are saying, "What if I don't have a B: drive?!". Use DISKCOMP like this:

C:\diskcomp a: a:

DISKCOMP will ask you to insert the first diskette into drive A:, then it will scan this disk. It will then ask for the second disk and scan it. If they are identical it will tell you, if they are not it will also tell you.


BACKUP
This was
This web page is copyrighted by Nathan Heald. Reproduction is allowed as long as this message is not removed or modified in any way. Frames site  No-frames site. How to print pages off of this site. The official URL of DOS HeadQuarters is http://dos.rsvs.net