| Mission | Technology |
| Computer's & Government   |
| Privacy & Security  |
| Bo's Microsoft Bug of the Month |

 

| Computer Security Alerts |
| Help & How To's |
Bo's Internet |
| Bo's News & Reviews |


Freeware
| Freeware From A-Z | Security | Virus Information | Site Updated on 11/14/05
For more on DOS commands and what they mean, check out
this Microsoft Knowledgebase Article: Command-line reference A-Z

Remember DOS?
Thought you got rid of it with Windows XP (Home or Professional)?

Think again!

If you thought that DOS was a dead porgy, you may be surprised to learn that even in Windows XP with DEM (DOS Emulation Mode) you have some valuable tools at your finger tips.

Remember the good old days of Windows 2.0 and on up to Windows Me? Remember that pristine little C:\> prompt? Remember how you used to do all kinds of magic with that command line that was difficult if not impossible with Windows GUI? Well, if you thought DOS was dead, you are in for a pleasant surprise. If you have never used DOS commands, then it might be a good idea to keep this little page handy in the advent of an emergency. Here are just a few of the commands which are available with Windows XP and 2000.

How do I use DOS or DEM?
To use DOS Emulation Mode in Windows XP click Start | Run | and type: COMMAND. Hit the enter key or click okay.
In Windows 9.x, simply boot the machine and hold down on the Ctrl key until the DOS menu appears, then select "Command Prompt Only" from the list and hit enter.

Tip: To automate some of these commands create an old fashioned DOS batch file.
How to create a Batch file:
If you are using Windows 9.x you have two options for creating a batch file. To create a batch file in DOS follow the steps above to get to the C:\> prompt and then

  1. Type EDIT at the C:\> prompt.
  2. The DOS text editor will open.
  3. Type in your commands just as you would at the C:\> prompt
  4. Click File | Save As (F+A)
  5. Give the file a name ending in .BAT
  6. Now click Exit (F+X)

Transversely, in any version of Windows:

  1. Click Start | Run
  2. Type:
    Notepad
  3. Hit the enter key on your keyboard or for all you mouse junkies click okay
  4. Notepad (C:\Windows\Notepad.exe) will open
  5. Type in your DOS commands, [Tip within a tip: If you want the screen to clear after each command is processed, type CLS on it's own line]
  6. Click File | Save As (Alt+F+A) and give the batch file a name but do not forget to give it the extension of BAT. For Example:
    YourFile.bat
  7. Place it anywhere on the drive or folder that you will remember.
  8. And...You are done.
  9. You can also place your batch file in the Startup folder to have it launch automatically every time you start Windows. This is handy for routine tasks you do everyday. To coin a phrase..."Set it and forget it".

You now have a batch file which can be run from DOS or from Windows. If you have Windows 9.x you have a number of different commands which Windows XP, unfortunately doesn't have. To discover what any DOS command will do or for the command line switches and interpreters simply type the command followed by a space then a switch (/) followed by a (?). The list of command line switches will be displayed. For example, lets say that your machine has been acting a little flaky lately, in DOS (This must be done in a true DOS environment, not a Windows DOS box [Hold down on the Ctrl key while booting | Selecting Command Prompt only from the DOS menu]) then type, at the C:\> prompt, SCANREG followed by a space and then the switch / then a question mark (?). So that it looks like this example:

SCANREG /?

This will give you some e very valuable options. For example:

SCANREG /FIX ....Will give you some options on repairing your System Registry (Works for Windows 95 to Me only)
SCANREG /RESTORE ...Will give you some choices to restore the system registry to a former time when your machine was  working just fine. Try this if you have installed a program and notice that your system is acting a little strange or not working at all. (Works for Windows 95 to Me only)

CD VOL VER ATTRIB
CHKDSK  DELTREE   DISKCOPY      DOSKEY    
EXTRACT   MEM MORE MODE
SYS
Managing disks
Convert DiskPart Format   Fsutil    Mountvol
View the Chart of Acceptable Win XP Commands

The Commands:
Type:

CD\ = Brings you to the top of the Directory (Folder) tree on the drive you are using.

VOL = This will give your the volume and partition ID of your machine
C:\>vol
Volume in drive C is WINDOWS_XP
Volume Serial Number is 1HEF-181C

VER = Gives the version of your Operating System (OS)
C:\>ver

Microsoft Windows XP [Version 5.1.2600]

ATTRIB
The ATTRIB.EXE command is critical for working with three types of files in a DOS environment: hidden files, read-only files, and system files. By following the ATTRIB command with a filename; a plus or minus sign; and the letter S, H, or R, you can add or remove the hidden, read-only, and system attributes from a file. For example, if you wanted to make every file in your current directory visible, you could use the command below to remove the hidden attribute:
ATTRIB *.* -h

If you wanted to hide a file that was presently visible, you’d enter the ATTRIB command followed by the file name, the plus sign, and an H. The syntax for working with system files and read-only files is identical. The only difference is that you must substitute the H (hidden) with either R (read-only) or S (system). You can also use multiple switches in conjunction with each other. For example, if you wanted to remove all three attributes from a file named TEST.SYS, you’d enter the following command:
ATTRIB TEST.SYS –S –H -R

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename]
[/S [/D]]

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
[drive:][path][filename]
Specifies a file or files for attrib to process.
/S Processes matching files in the current folder
and all subfolders.
/D Processes folders as well.

CHKDSK
Although CHKDSK has never completely gone away, ScanDisk has overshadowed it. However, I believe the CHKDSK command is the quickest and easiest way to see how much disk space is available and if there are any problems with the disk. Issuing the CHKDSK command by itself generates a report, while entering the CHKDSK /F command repairs any errors that are found.

C:\>chkdsk /?
Checks a disk and displays a status report.


CHKDSK [volume[[path]filename]]] [/F] [/V] [/R] [/X] [/I] [/C] [/L[:size]]


volume Specifies the drive letter (followed by a colon),
mount point, or volume name.
filename FAT/FAT32 only: Specifies the files to check for fragmentation
.
/F Fixes errors on the disk.
/V On FAT/FAT32: Displays the full path and name of every file
on the disk.
On NTFS: Displays cleanup messages if any. - NOTE - Only works with Windows XP, W2K, NET
/R Locates bad sectors and recovers readable information
(implies /F).
/L:size NTFS only: Changes the log file size to the specified number - NOTE - Only works with Windows XP, W2K, NET
of kilobytes. If size is not specified, displays current
size.
/X Forces the volume to dismount first if necessary.
All opened handles to the volume would then be invalid
(implies /F).
/I NTFS only: Performs a less vigorous check of index entries.- NOTE - Only works with Windows XP, W2K, NET
/C NTFS only: Skips checking of cycles within the folder - NOTE - Only works with Windows XP, W2K, NET
structure.

The /I or /C switch reduces the amount of time required to run Chkdsk by
skipping certain checks of the volume.

 

DELTREE - Works for Windows 95 to Me only
If you’ve ever tried to delete a large directory structure from the DOS prompt, you know how tedious it can be. You must remove the contents of each subdirectory individually before you can erase the main directory. For example, suppose you had a directory called LETTERS that contained the sub-directories A, B, and C. Using the normal DOS commands, you’d have to enter the following sequence of commands to remove the LETTERS directory:
CD\LETTERS\A
ERASE *.*
CD..
RD A
CD B
ERASE *.*
CD..
RD B
CD C
ERASE *.*
CD..
RD C
ERASE *.*
CD..
RD LETTERS


The DELTREE command replaces this tedious sequence of commands with a single command. Entering DELTREE LETTERS does the same thing as issuing all of the commands above. DELTREE deletes a directory and everything in it, including subdirectories and their contents.

DISKCOPY
The DISKCOPY command is used to duplicate a floppy disk. To use this command, type DISKCOPY followed by the source drive and the destination drive, then press [Enter]. For example, you might enter DISKCOPY A: A:. After doing so, the DISKCOPY utility will prompt you as to when to insert the source disk (the original media) and the destination disk (the blank media), and will walk you through the copy process.

C:\>diskcopy /?
Copies the contents of one floppy disk to another.

DISKCOPY [drive1: [drive2:]] [/V]

/V Verifies that the information is copied correctly

The two floppy disks must be the same type.
You may specify the same drive for drive1 and drive2.

DOSKEY
The DOSKEY command allows you to repeat commands you’ve already typed by pressing the up arrow. This is especially handy if you’re doing a complex procedure with a lot of repetitive typing. To use the command, simply type DOSKEY once, then press [Enter]. From that point until you reboot the machine, any commands that you enter will be buffered. These commands can be recalled by pressing the up arrow. To recall something entered three commands back, for example, you'd press the up arrow three times.

C:\>doskey /?
Edits command lines, recalls Windows XP commands, and creates macros.

DOSKEY [/REINSTALL] [/LISTSIZE=size] [/MACROS[:ALL | :exename]]
[/HISTORY] [/INSERT | /OVERSTRIKE] [/EXENAME=exename] [/MACROFILE=filename]
[macroname=[text]]

/REINSTALL Installs a new copy of Doskey.
/LISTSIZE=size Sets size of command history buffer.
/MACROS Displays all Doskey macros.
/MACROS:ALL Displays all Doskey macros for all executables which have
Doskey macros.
/MACROS:exename Displays all Doskey macros for the given executable.
/HISTORY Displays all commands stored in memory.
/INSERT Specifies that new text you type is inserted in old text.
/OVERSTRIKE Specifies that new text overwrites old text.
/EXENAME=exename Specifies the executable.
/MACROFILE=filename Specifies a file of macros to install.
macroname Specifies a name for a macro you create.
text Specifies commands you want to record.

UP and DOWN ARROWS recall commands; ESC clears command line; F7 displays
command history; ALT+F7 clears command history; F8 searches command
history; F9 selects a command by number; ALT+F10 clears macro definitions.

The following are some special codes in Doskey macro definitions:
$T Command separator. Allows multiple commands in a macro.
$1-$9 Batch parameters. Equivalent to %1-%9 in batch programs.
$* Symbol replaced by everything following macro name on command line.

EXTRACT (For more on the Extract Command, See Bo Explains the Extract command) - Works for Windows 95 to Me only
If you’ve ever looked at the contents of your Windows CD, you probably know that all the files that make up Windows are stored in a compressed format within CAB files. If you need to replace a damaged Windows file, you can use the EXTRACT command to decompress the file you need. Space doesn’t allow me to get into all of the particulars of using the EXTRACT command, but it’s important for you to know that the command exists. You can acquire the various syntax's for the command by typing EXTRACT /?.

MEM
The MEM command allows you to view modules and drivers currently loaded in memory. To use this command, simply enter MEM /C at the command prompt. You’ll then see a detailed summary of the machine’s memory usage. Remember that you’re working in DOS mode, so you won’t see anything related to how Windows is using memory unless you use the MEM command while Windows is running. Instead, you’ll see how your boot disk is managing memory

C:\>mem /?
Displays the amount of used and free memory in your system.

MEM [/PROGRAM | /DEBUG | /CLASSIFY]

/PROGRAM or /P Displays status of programs currently loaded in memory.
/DEBUG or /D Displays status of programs, internal drivers, and other
information.
/CLASSIFY or /C Classifies programs by memory usage. Lists the size of
programs, provides a summary of memory in use, and lists
largest memory block available.

Note: When you use some of these commands they can go off the visible screen, (in Windows XP this is not a problem). To prevent this, add More to the command, for example, MEM /C/MORE will prompt you to press a key to view the remainder of the command. or simply type MEM /C |
This is called a pipe and means the same as MORE but doesn't have any switches.
The | is that which, on most keyboards, is above the back slash or \

In Windows XP you have some added options:

MORE
Occasionally, you may run into a situation in which a command displays more data than you can read. For example, the MEM /C command almost always scrolls data off of the screen before you can read it. Using the MORE command causes the computer to show you only one screen of information at a time. For example, if you enter MEM /C | MORE, the system will display the memory usage screen-by-screen. The MORE command also works for viewing files. Suppose you have a long text file called README.TXT. If you enter the command TYPE README.TXT, the computer will display the file too quickly to read. However, entering TYPE README.TXT | MORE will cause the computer to display the file one screen at a time.

C:\>more /?
Displays output one screen at a time.

MORE [/E [/C] [/P] [/S] [/Tn] [+n]] < [drive:][path]filename
command-name | MORE [/E [/C] [/P] [/S] [/Tn] [+n]]
MORE /E [/C] [/P] [/S] [/Tn] [+n] [files]

[drive:][path]filename Specifies a file to display one
screen at a time.

command-name Specifies a command whose output
will be displayed.

/E Enable extended features
/C Clear screen before displaying page
/P Expand FormFeed characters
/S Squeeze multiple blank lines into a single line
/Tn Expand tabs to n spaces (default 8)

Switches can be present in the MORE environment
variable.

+n Start displaying the first file at line n

files List of files to be displayed. Files in the list
are separated by blanks.

If extended features are enabled, the following commands
are accepted at the -- More -- prompt:

P n Display next n lines
S n Skip next n lines
F Display next file
Q Quit
= Show line number
? Show help line
<space> Display next page
<ret> Display next line

MODE
Sometimes a utility may alter the system’s video settings, making the screen unreadable. If this happens, you can use the MODE command to return the screen to a readable state. For example, to return the screen to a standard DOS format, you’d enter MODE CO80. With any luck, the screen will flicker a few times and then become readable.

C:\>mode /?
Configures system devices.

Serial port: MODE COMm[:] [BAUD=b] [PARITY=p] [DATA=d] [STOP=s]
[to=on|off] [xon=on|off] [odsr=on|off]
[octs=on|off] [dtr=on|off|hs]
[rts=on|off|hs|tg] [idsr=on|off]

Device Status: MODE [device] [/STATUS]

Redirect printing: MODE LPTn[:]=COMm[:]

Select code page: MODE CON[:] CP SELECT=yyy

Code page status: MODE CON[:] CP [/STATUS]

Display mode: MODE CON[:] [COLS=c] [LINES=n]

Typematic rate: MODE CON[:] [RATE=r DELAY=d]

SYS  - Works for Windows 95 to Me only
The SYS command allows you to make any floppy disk or hard disk bootable. For example, if you were working on a computer that had a hard drive with a boot sector destroyed by a virus, you could boot from your emergency repair floppy or CD and run the command SYS C:. This would add the IO.SYS, MSDOD.SYS, and COMMAND.COM files to the damaged hard disk, making it bootable once again.

Keep in mind, though, that any time you use the SYS command on a disk, the boot files from the source disk (floppy, CD, or hard disk) will be copied to the target drive. So make sure that the target system is running the same operating system as the source disk. For example, you could use a repair disk created on a Windows 98 machine as the source disk for another Windows 98 machine, but you wouldn’t want to use a Windows 98 repair disk as the source for a Windows ME machine.

Convert FAT 32 drives to NTFS volume drives:

  • Open Command Prompt.
  • In the command prompt window, type

    convert drive_letter: /fs:ntfs

    For example, typing convert D: /fs:ntfs would format drive D: with the ntfs format.

FAT 32 = file allocation table (FAT) A file system used by MS-DOS and other Windows-based operating systems to organize and manage files. The file allocation table (FAT) is a data structure that Windows creates when you format a volume by using the FAT or FAT32 file systems. Windows stores information about each file in the FAT so that it can retrieve the file later.

NTFS = NTFS file system An advanced file system that provides performance, security, reliability, and advanced features that are not found in any version of FAT. For example, NTFS guarantees volume consistency by using standard transaction logging and recovery techniques. If a system fails, NTFS uses its log file and checkpoint information to restore the consistency of the file system. In Windows 2000 and Windows XP, NTFS also provides advanced features such as file and folder permissions, encryption, disk quotas, and compression.

The following commands are available in Windows XP, W2K, and NET only

Managing disks and volumes from the command lineIn addition to using the Disk Management 
snap-in, you can use command-line utilities to manage disks and volumes.

For example, you can use:
  • Chkdsk -  to check disks for errors and repair any errors found. - This is found in Win 9.x but it 
    doesn't mean the same thing as it does in W2K
  • Convert  - to change FAT or FAT32 volumes into NTFS volumes. 
  • DiskPart - to extend basic volumes, assign or remove a disk's drive letter, create or delete
    partitions and volumes, or bring off-line disks and volumes online. 
    
    In Win 9.x you can use: FDISK
  • Format - to format a volume or mounted drive with a file system. - Also available with a 9.x system
  • Fsutil - to perform many NTFS file system related tasks, such as managing disk quotas, 
    dismounting a volume, or querying volume information. Because fsutil is quite powerful, it should 
    only be used by advanced users who have a thorough knowledge of Windows XP. 
  • Mountvol - to mount a volume at an NTFS folder or unmount the volume from the NTFS folder. 

Format Some of these commands are W2kSpecific
C:\>format /?
Formats a disk for use with Windows XP.

FORMAT volume [/FS:file-system] [/V:label] [/Q] [/A:size] [/C] [/X]
FORMAT volume [/V:label] [/Q] [/F:size]
FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors]
FORMAT volume [/V:label] [/Q]
FORMAT volume [/Q]

volume Specifies the drive letter (followed by a colon),
mount point, or volume name.
/FS:filesystem Specifies the type of the file system (FAT, FAT32, or NTFS). W2kSpecific
/V:label Specifies the volume label.
/Q Performs a quick format.
/C NTFS only: Files created on the new volume will be compressed W2kSpecific
by default.
/X Forces the volume to dismount first if necessary. All opened W2kSpecific
handles to the volume would no longer be valid.
/A:size Overrides the default allocation unit size. Default settings
are strongly recommended for general use.
NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.
FAT supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K,
(128K, 256K for sector size > 512 bytes).
FAT32 supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K,
(128K, 256K for sector size > 512 bytes).

Note that the FAT and FAT32 files systems impose the
following restrictions on the number of clusters on a volume: W2kSpecific

FAT: Number of clusters <= 65526 W2kSpecific
FAT32: 65526 < Number of clusters < 4177918 W2kSpecific

Format will immediately stop processing if it decides that
the above requirements cannot be met using the specified
cluster size.

NTFS compression is not supported for allocation unit sizes
above 4096. W2kSpecific

/F:size Specifies the size of the floppy disk to format (1.44) W2kSpecific
/T:tracks Specifies the number of tracks per disk side. W2kSpecific
/N:sectors Specifies the number of sectors per track. W2kSpecific

Windows XP users: If you miss some of your old commands and they do not seem to work in XP, they probably are no longer supported. The below link will show you what is and what isn't supported.

Need more info? Click here for a chart which shows what commands are available and somewhat how to use them.