| | Mission | Technology
| | Computer's & Government | | Privacy & Security | | Bo's Microsoft Bug of the Month | |
|
| Computer
Security Alerts | |
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
Transversely, in any version of Windows:
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 [+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.
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 youve 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,
youd 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.
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.
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 youve 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 doesnt allow me to get into all of the particulars of using the
EXTRACT command, but its important for you to know that the command exists. You can
acquire the various syntax's for the command by typing EXTRACT /?.
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:
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
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]
Convert FAT 32 drives to NTFS volume drives:
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.