Welcome to

DOS Commands - A Useful list Feb 11, 2001

I came across the following list of Dos commands at: The Lazy Ant some time ago and ran a copy for myself just in case I ever needed a hard copy; turns out I have used it several times.

The Lazy Ant site has lots of other useful information for Win95/Win98 users.

___________________________________________________________

Basic Commands

- DIR Shows a list of directories and files from the current directory.

Example, popular choices: DIR /W Presents a column format without details. Another option when you have too many files in the screen is: DIR /P , this will prompt you before scrolling.

To search a file: DIR file /S This will start looking from the current directory 'downwards', so if you don't know in which directory the file is, you have to change your directory to 'root' (see below).

- CD Change Directory. CD example will change the current directory to a subdirectory called 'example' right below. CD .. will move us to the parent directory. CD \ will go to the 'root' or highest directory (usually C:\) and we can also type the whole path: CD C:\Windows\System

- DEL Deletes a file (also is the same: ERASE).

- REN Renames (changes the name) a file.

- COPY to copy one or more files. This command is not very powerful, because you can use wildcards but you cannot copy whole directories. So it is better to use XCOPY (or XCOPY32) they are under C:\Windows\Command.

- MOVE moves a file, that is equivalent to copy and delete the original file.

- MKDIR or MD , creates a directory under the current one.

- RMDIR or RD , removes a directory. Again, like the copy command, this is not very powerful if we want to delete lots of subdirectories (like C:\Windows), because every directory has to be empty before using RD. The right tool is DELTREE.

__________________________________________________________

Utility Commands
Most of these tools can be found in the C:\Windows\Command folder.

- EDIT The DOS-mode text editor.

- MEM Gives us information about the amount of RAM used. Specially interesting is MEM /C

- VER (Internal) will tell us the operating system version.

- FORMAT , to format drives. For floppy disks, we can use FORMAT /Q to perform a "quick format" (actually, deleting all files). To create a bootable floppy we can use FORMAT /S. This will copy the system files, and it's equivalent to use SYS A: on a formatted floppy.

- SYS Transfers the system files (io.sys, msdos.sys -both hidden files- and command.com). This is used to create a bootable floppy disk or to try to recover a hard disk with Windows that doesn't startup from a floppy with the system. Not to be used carelessly. Usually the floppy has to have the same version of Windows that the corrupted one to do the trick.

- MSD Microsoft Diagnostics. If there is nothing else around, and we need, for example, to check the resources (IRQs...) of a computer that doesn't boot.

- CHKDSK and SCANDISK (DOS version). Utilities to check file system problems that can be ran from a floppy in the DOS version. - ATTRIB to change the attributes of a file.

- FDISK is the tool to partition hard disks, the first step in the installation of an operating system, before formatting.

- EXTRACT is the uncompressing tool for Microsoft's 'cabinet' (.cab) files, files that are compressed in a similar way that 'zipped' files.

___________________________________________________________

Here are some some other commands that you may find useful.

- DOSSHELL Invokes the MS DOS shell.

- EXIT Exits to a previous program.

- FIND "string" file Searches a file or files for a string of characters.

- FORMAT drive Formats a floppy disk.

- UNFORMAT Restores a disk erased by the FORMAT command

- HELP [command] Displays help on MS DOS commands

- UNDELETE file Undeletes a previously deleted file

_____________________________________________________________

Here are a few directions on using wildcard variables.

DOS commands that deal with files allow you to specify files by name, or to approximate names by using special characters, called wildcard characters, that match several file names.

Wildcards can be used just about any commands that deal with files: dir, copy, rename, xcopy, and more.

Matching any group of letters:

* (star, or asterisk) matches any group of letters in the file name after the asterisk

Matching any single letter:

? (question mark) matches any single letter in the file name.

Examples:
dir *.* List all files

dir *.exe List all files with extension exe

dir prog1.* List all files with the name prog1 regardless of their extension

dir q*.* List all files beginning with the letter q

copy *.bat b: Copy all files with the extension .bat to drive b:

dir budget?a.dat List files whose name begins with budget,
has any single character, ends with a and
has the extension .dat

- for example: budget1a.dat budget2a.dat budget3a.dat

_____________________________________________________________

and that's all for now folks.