MBFU RU

MS-DOS command reference: the commands you actually use

Most MS-DOS work is done with a dozen commands. This reference lists them one line at a time, with the switch that usually matters, plus warnings for the commands that destroy data.

Files and directories

These commands list, navigate and manage directories. They are safe to try on any disk.

  • DIR — list a directory. /P pauses after each screen, /W gives the wide format, /A shows hidden and system files. See the DIR command page.
  • CD — change directory. CD \ goes to the root, CD .. goes up one level.
  • MD — make a directory. RD removes an empty one only.
  • PATH — set the directories searched for programs, for example PATH C:\;C:\DOS.
  • SET — show or set environment variables such as COMSPEC or TEMP.

Copying and renaming

COPY handles single files and simple concatenation. XCOPY handles directory trees, which is what you need when moving a whole folder structure between disks.

  • COPY — copy one file or several. Wildcards work: COPY *.TXT A:. Examples are on the COPY command page.
  • XCOPY — copy directories. /S includes subdirectories, /E also copies empty ones.
  • REN — rename a file in place. It cannot move a file to another directory.
  • ATTRIB — show or change attributes. +R sets read-only, -H clears hidden.
  • TYPE — print a text file to the screen, or TYPE FILE.TXT | MORE for long files.
  • EDIT — the full-screen text editor that arrived with MS-DOS 5.00.

Deleting and recovering

Deletion in DOS is immediate. There is no recycle bin, so the only recovery route is UNDELETE, and only if the file has not been overwritten.

  • DEL — delete files. /P asks for confirmation before each file.
  • DELTREE — delete a directory and everything inside it, without prompting.
  • UNDELETE — try to restore deleted files. Stop writing to the disk first.

Disks, system files and diagnostics

The commands in this group change the disk itself. Read the warning below first.

Warning: FORMAT, FDISK and DEL destroy data permanently. FORMAT erases the file system on the selected partition, FDISK can delete partitions and rewrite the partition table, and DEL removes files with no undo. Check the drive letter twice.

  • FORMAT — prepare a partition. /S also copies the system files, /Q does a quick format, /U forces an unconditional format.
  • FDISK — create and delete partitions and set the active one.
  • SYS — transfer the DOS system files to a disk so it becomes bootable.
  • CHKDSK — check the disk and report lost clusters. /F fixes errors.
  • SCANDISK — the later, more thorough checker introduced with MS-DOS 6.x.
  • MEM — show conventional, upper and extended memory. MEM /C lists what is loaded where.
  • LABEL — show or change the volume label.
  • SMARTDRV — install a disk cache to speed up repeated reads.

Command pages for the destructive tools: FORMAT, FDISK, SYS.

Switches worth remembering

Five switches cover most daily work. /S means include subdirectories for XCOPY and copy system files for FORMAT. /P means pause or prompt. /W means wide listing for DIR. /A means attributes for DIR and ATTRIB. /Y means answer yes to overwrite prompts. A stick made with MBFUTool 2.0 boots into a BEN menu for these tools, and writes to the system disk are blocked.

Step by step

  1. Open a command prompt. Boot MS-DOS, or start the DOS prompt from the BEN menu on an MBFUTool stick.
  2. Identify the drive. Run DIR on the letter you intend to use and confirm the files match the disk you mean.
  3. Run the command. Type the command with its switch, for example DIR /P or COPY *.TXT A:.
  4. Verify the result. List the directory again, or run CHKDSK on the disk, before you unplug anything.

Questions

Do I need to memorise all of these?
No. DIR, CD, COPY, DEL, MD and RD cover most work. The rest are needed when something breaks or when you prepare a disk.

Is DELTREE recoverable?
Only with UNDELETE, and only if nothing has been written to the disk since.

Why does RD refuse to delete my directory?
RD only removes empty directories. Delete the files inside first, or use DELTREE.