Home Page 4
Index Next Page
DOS for Windows9x

Further Useful DOS Commands

CommandFor CommandFor
ChkdskChecking a Drive's status FDiskConfiguring/Partitioning Hard Disks
MoveMoving Files/Renaming Directories SysCopying System Files
RDRemoving (Deleting) Directories XCopyCopying Files in a DOS Box (and
TypeDisplaying Text File Contents   Explanation of copying in DOS Mode/DOS Box)
Using DOS Commands      Essential Commands      Main Topic Index

CHKDSK - Checks a Drive's status.
Usage:
       chkdsk drive switch
Switches:
  • /V   Lists the path and name of all files on a disk.
  •     With no switch Chkdsk displays the current disk status.
This is a quick way to do a quick check. To check a drive for errors etc, use Scandisk instead.
FDISK - Configures a hard drive.
Usage:
       FDISK
Switches:
  • /STATUS   Reports the current configuration.
  • All other actions are specified from within the program.
FDISK is normally only required to partition a hard disk or to change the FAT (Windows95b / OSR/2 or later only). To clear a drive of data prior to re-installation of Windows or for any other reason, use FORMAT which must be run after FDISK anyhow. For more information on usage see Low-Level Formatting.

The Win95 version of FDISK will wipe the data on all partitions. For this reason, use of PowerQuest's 'Partition Magic' or a similar Third-Party program is preferable, as it can create and resize partitions without affecting the data, as well as setting the FAT. Win98 has a somewhat better utility.
Top of Page     Main Topic Index

RD - Removes (deletes) a Directory.
Usage:
       RD path+name
Example:
       RD D:\DATA\DOWNLOAD   deletes the directory.
MOVE - Moves Files and Renames Directories.
Usage:
       MOVE path+name path+name
Switches:
  • /Y   Suppresses asking if you want to create a new Directory or File.
  • /-Y   Enforces asking if you want to create a new Directory or File.
Examples:
       MOVE /-Y C:\WINDOWS\SYSTEM.BAK SYSTEM.BA1 D:\DATA\BACKUPS\SYSTEM.1   Moves SYSTEM.BAK to another directory and renames it, asking if SYSTEM.1 is to be a File or Directory.
       MOVE D:\DATA\DOWNLOAD\MISC D:\MISC   renames D:\DATA\DOWNLOAD as a new directory D:\MISC.
Top of Page     Main Topic Index

TYPE - Types (displays) the contents of a file (if this is possible).
Usage:
       TYPE filename
Switches:
  • >PRN   Redirects the output to the Printer.
  • |MORE   Pauses after each screenful.
Examples:
       TYPE c:\config.sys >PRN   Causes the file to be printed.
       TYPE c:\games\tennis\readme.txt |MORE   Causes the file to be displayed, a page at a time.

Note: The   |MORE   'switch' has to be used here in place of the   /P   switch used with DIR and must have the   |   'pipe' character instead of the   /   backslash. An alternative using   MORE   as a command in itself (which can only be done with with a   *.txt   text file) would be:
       MORE c:\games\tennis\readme.txt
SYS - Copies System files.
Usage:
       sys drive drive
Examples:
       sys c: a:   copies the files to a floppy.
       sys a: c:   copies the files from a floppy.

If copying to a floppy, only use one which has already been Formatted - or use the /S switch with FORMAT to do it.

This is a quick way to get a newly formatted hard drive to be able to boot itself, by copying the basic files from a boot floppy. The files copied are: Command.com, IO.sys, MSDOS.sys and Drvspace.bin.
Or you can create a 'Bootable Floppy', which you can then customise by adding files etc. By itself it is more of use in dire emergencies than anything else - certainly not for restoring Windows. (See Re-Installing Win9x for more on creating boot disks).
Top of Page     Main Topic Index

XCOPY - Copying Files in a DOS Box.
In a DOS Box   XCOPY   runs as the 32-bit   XCOPY32   which supports Long File Names
or at least copies them correctly.   See below for more about this
.

Usage:
       xcopy switches path+name(s) path+name(s) or
       xcopy switches source destination
Switches:
These only work with   XCOPY   in a DOS Box,   not with   XCOPY   in DOS Mode - see below.
  • /A   Copies files with the Archive attribute & doesn't change it.
  • /C   Continues copying if errors occur (otherwise it stops).
  • /F   Full display of source & destination filenames during copying (see /Q).
  • /K   Copies Attributes (otherwise Xcopy resets Read-only attributes).
  • /R   Overwrites Read-only files.
  • /S   Copies directories & sub-directories, less empty ones. (/S /E or just /E includes empty ones).
  • /T   Creates directory structure only - does not copy files. Excludes empty directories & sub-directories ( /T /E includes empty ones).
  • /U   Updates files already in the destination directory.
  • /Y   Overwrites existing files without asking.
  • /M   Copies files with the Archive attribute & turns it off.
  • /-Y   Asks you before overwriting existing files.
  • /E   Copies directories & sub-directories, including empty ones. (Same as /S /E).
  • /H   Copies Hidden & System files, obviating the need to change their Attributes first.
  • /I   If destination does not exist & copying more than one file assumes destination must be a directory.
  • /N   Copy using DOS' short Names (A bad idea!)
  • /Q   Quiet mode - does not list file names while copying (You can't read the list anyhow!)
  • /L   Lists files that would be copied, but doesn't copy them. (As a check you've got it right!)
  • /P   Asks before creating each destination file. (Tedious with big directories!)
  • /W   Asks you to press a key before starting. (Pause for thought).
Examples:
       XCOPY /H C:\WINDOWS\SYSTEM.DAT C:\BACKUPS\SYSTEM.BAK    copies   C:\WINDOWS\SYSTEM.DAT   and saves it as   C:\BACKUPS\SYSTEM.BAK

       XCOPY /C /E /H /I /K /Q C:\WINDOWS\*.* D:\WINDOWS\*.*    copies the entire C:\WINDOWS\ directory & sub-directories to drive   D:  , not stopping at errors (though they will be notified), including Hidden & System files and empty directories, retaining Attributes, without listing files during copying.

       XCOPY C:\WINDOWS\FONTS\*.TTF E:\FONTS\*.TTF    copies all the True-Type fonts to a folder called   E:\FONTS   It is quicker to copy the lot and delete the obvious ones wholesale than choose them one-by-one if you have a lot of non-standard fonts.

On my machine the second example can copy almost 2,000 files across in under 2 minutes with 3 other applications open. The only 'error' is usually the Windows Swap file, due to it being in use (I wouldn't want it anyhow!). This is simply a test example. Backing up Data files with a similar command would be faster unless they were massive images and databases.
All you need do is work out the appropriate command for your setup (note the /U switch), save it in a Batch file (for an example see Creating Batch Files) and run it from a DOS Box. Or create a shortcut to the file from your Start Menu - clicking on it will open the DOS Box and start it running.

The third example is a simple one for simply backing up fonts, usually prior to re-installing Windows (see Preparation.   I have included it because Explorer will not copy installed Font files anywhere! There is no point copying the 'system' fonts (files ending in '.fon', which show up with red icons in Explorer) as they will be re-installed automatically.
~ An Explanation:   XCOPY and XCOPY32 in DOS Mode as against a DOS Box ~
~ Please pay attention if you want to fathom this out. I'm not taking the blame if you use the wrong one. OK? ~
  • You can use   COPY   in DOS Mode but   XCOPY   is better, so I've ignored it.
  • Using   XCOPY   in DOS Mode means using   XCOPY   with Real Mode switches.
  • DOS (Real Mode) is a 16-bit Operating System.   Windows95 is a 32-bit Operating System.
  • Using   XCOPY   in a DOS Box means using   XCOPY32   because Windows cuts in and substitutes the 32-bit version.
  • For a clear idea of how Windows takes over a DOS command, open a DOS Box and enter:
        REGEDIT /?   This should simply display the available switches ... OK - now close the Registry Editor!
  • XCOPY   and   XCOPY32   in a DOS Box are therefore in effect the same thing.
        ...    Are you with me so far?
  • You can't use the 32-bit command   XCOPY32   in DOS Mode - only in a DOS Box.
  • XCOPY   in DOS Mode and   XCOPY32   in a DOS Box have different Switches.
  • However, using   XCOPY   in a DOS Box means using   XCOPY32   Switches.
  • As   XCOPY32   is longer to type <sigh>, and automatically takes over from   XCOPY   in a DOS Box anyway, it may as well be referred to as  'XCOPY'.
  • Hence the distinction between 'Xcopy in DOS Mode' and 'Xcopy in a DOS Box'.
        ...    Are you still with me? ... Well done!
Top of Page     Main Topic Index

Next Page

< Home >