The PC Primer: The DOS (Command) environment

DOS as a seperate Operating system ceased to exist with the advent of Windows 95, prior to Win95 you had to install DOS (from three 1.44 floppy disks) then if you wished Windows (from 8 fd's) the last 'stand alone' version of DOS was V6.22 and Windows was V3.11.

A lot of people thought Windows 95 was the end of civilisation as we knew it and some thought it the spawn of the devil (sorry Bill), however most of us, as is the way of things grew to accept it.

As we found our way around our new 'friend' we realised that in some ways it was 'Dumber' than DOS, taking longer to delete, copy and move files amongst other things. Users nowdays will if they take the time find this still to be the case if they take the time to learn The cutdown DOS that still lives behind the 'Command' window.

I've written this section with an in depth view of true DOS , but bear in mind there are dissimilarities between it and what's available now.

The three DOS 6.22 disks

The DOS (Command) environment

DOS (Disk Operating System) was the first OS for the IBM based PC. It provided the user with the functionality that became available in Windows and a lot more beside.

The DOS environment is termed a "command line" environment, where the user types commands at a cursor, hits the return key and the command is actuated.

The advent of Windows led users away from DOS, but to the informed user the DOS environment can for example allow far quicker manipulation of files, be that copying, moving, or deleting

DOS commands are typed at a prompt, so at the 'C:\>' prompt you could type Format a:, this would format a floppy disk in the 'A' drive.

The commands are listed below and each may be used with 'switches' which are explained later.

 

ASSOC Displays or modifies file extension associations
AT Schedules commands and programs to run on a computer.
ATTRIB Displays or changes file attributes.
BREAK Sets or clears extended CTRL+C checking.
CACLS Displays or modifies access control lists (ACLs) of files.
CALL Calls one batch program from another.
CD Displays the name of or changes the current directory.
CHCP Displays or sets the active code page number.
CHDIR Displays the name of or changes the current directory.
CHKDSK Checks a disk and displays a status report.
CHKNTFS Displays or modifies the checking of disk at boot time.
CLS Clears the screen.
CMD Starts a new instance of the Windows command interpreter.
COLOR Sets the default console foreground and background colors.
COMP Compares the contents of two files or sets of files.
COMPACT Displays or alters the compression of files on NTFS partitions.
CONVERT Converts FAT volumes to NTFS. You cannot convert the current drive.
COPY Copies one or more files to another location.
DATE Displays or sets the date.
DEL Deletes one or more files.
DIR Displays a list of files and subdirectories in a directory.
DISKCOMP Compares the contents of two floppy disks.
DISKCOPY Copies the contents of one floppy disk to another.
DOSKEY Edits command lines, recalls Windows commands, and creates macros.
ECHO Displays messages, or turns command echoing on or off.
ENDLOCAL Ends localization of environment changes in a batch file.
ERASE Deletes one or more files.
EXIT Quits the CMD.EXE program (command interpreter).
FC Compares two files or sets of files, and displays the differences between them.
FIND Searches for a text string in a file or files.
FINDSTR Searches for strings in files.
FOR Runs a specified command for each file in a set of files.
FORMAT Formats a disk for use with Windows .
FTYPE Displays or modifies file types used in file extension associations.
GOTO Directs the Windows command interpreter to a labeled line in a batch program.
GRAFTABL Enables Windows to display an extended character set in graphics mode.
HELP Provides Help information for Windows commands.
IF Performs conditional processing in batch programs.
LABEL Creates, changes, or deletes the volume label of a disk.
MD Creates a directory.
MKDIR Creates a directory.
MODE Configures a system device.
MORE Displays output one screen at a time.
MOVE Moves one or more files from one directory to another directory.
PATH Displays or sets a search path for executable files.
PAUSE Suspends processing of a batch file and displays a message.
POPD Restores the previous value of the current directory saved by PUSHD.
PRINT Prints a text file.
PROMPT Changes the Windows command prompt.
PUSHD Saves the current directory then changes it.
RD Removes a directory.
RECOVER Recovers readable information from a bad or defective disk.
REM Records comments (remarks) in batch files or CONFIG.SYS.
REN Renames a file or files.
RENAME Renames a file or files.
REPLACE Replaces files.
RMDIR Removes a directory.
SET Displays, sets, or removes Windows environment variables.
SETLOCAL Begins localization of environment changes in a batch file.
SHIFT Shifts the position of replaceable parameters in batch files.
SORT Sorts input.
START Starts a separate window to run a specified program or command.
SUBST Associates a path with a drive letter.
TIME Displays or sets the system time.
TITLE Sets the window title for a CMD.EXE session.
TREE Graphically displays the directory structure of a drive or path.
TYPE Displays the contents of a text file.
VER Displays the Windows version.
VERIFY Tells Windows whether to verify that your files are written correctly to a disk.
VOL Displays a disk volume label and serial number.
XCOPY Copies files and directory trees.

PATH

The path statement sets or displays a search path for executable files, that is files with the suffix .exe (executable), .com (command), or .bat (batch), so typing a command in the

PATH [[drive:]path[;...][;%PATH%]

PATH ;

Type PATH ; to clear all search-path settings and direct cmd.exe to search only in the current directory.

Type PATH without parameters to display the current path.

Including %PATH% in the new path setting causes the old path to be appended to the new setting.

Wildcards

Wildcards are used when you wish to carry out a command on a number of files, they are used in conjunction with commands that manipulate files, such as move. copy or delete.

The wildcard symbol ‘*’ is substituted for a character in a command. For example:

dir *at.txt

would return a listing that might contain:

cat.txt
mat.txt
fat.txt
rat.txt

while the command del cat.* would delete:

cat.txt
cat.com
cat.exe
cat.dll

move c:\files\*at.* d:\newfiles\ would move (not copy) the files within the search criteria, from the source directory (c:\files\) to the destination directory (d:\newfiles\ ).

cat.txt
mat.txt
fat.txt
rat.txt
cat.com
cat.exe
cat.dll

 

Starting a DOS session

To start a DOS session ‘click’ on the Start botton on the taskbar (usually at the bottom of the screen) and when the menu appears select ‘Run’. This will bring up a dialoge box (Fig 2-1), type cmd and select OK, or press the return key and a DOS (Command) window will open (Fig 2-2).

Fig 2-1

 

Fig 2-2

 

Setting the DOS Prompt

By default Windows the command interpreter will show the current drive/path but you may wish to customise the prompt you see in the DOS window, you may either do this ‘on the fly’ by typing prompt= followed by one or more of the options listed below, for example typing ‘prompt=$d $t’ and pressing the return key will give you a prompt showing both the date and time as in Fig 2-3.

Fig 2-3

$P$G Displays at the prompt the current drive/path and the ">" symbol. Other commands are:

 

$$ $ (dollar sign)
$Q = (equal sign)
$G > (greater-than sign)
$T Current time
$D Current date
$P Current drive and path
$V MS-DOS version number
$N Current drive

You can however automate the process by creating a batch file that will issue the command whenever the computer is started. Batch files are simple text files that contain a command, or commands that could be typed in at the DOS prompt, but for the sake of convienence you wish to have issued when the computer starts.This file is called the Autoexec.bat file and although in Windows versions 95/NT/98/ this file is not automatically created as it was in earlier versions, you can still create it and it will function.

Open any word processor (notepad will do) and simply type the command:

prompt=$d $t

Then save the file as c:\autoexec.bat. Restart the computer and return to the DOS window. you will now see the prompt with the attributes you set.

The Directory structure

The directory structure in MSDOS as with all operating systems is pyramidic, with the root of a drive at the top of the pyramid. The root is generally symbolised by a drive letter (c:\) and this pyramidic structure may be echoed by:

Additional hard drives
Partitioned hard drives
Network drives
other devices (CD ROM, Zip Drives etc.)

These extra drives (D:, E:, etc.) are not part of the directory structure of the other drives, and to switch to another drive you will need to type in the drive letter. such a system with several drives all at the same level is called a ‘flat’ system.

Fig 2-1 Illustrates the directory structure of a typical one drive PC. Fig 2-4 shows a "flat" drive/directory structure of a multi drived, or networked PC, Fig 2-5 shows a multi-drived, or networked PC.

 

 

Fig 2-4 A one drive PC

 

Fig2-5 A multi-drived, or networked PC

 

Navigating the Directory Structure

Note that commands typed at the DOS prompt are not case sensitive.

Within DOS it is possible to perform many operations on your files and directories, such as moving, copying and deleting. To achieve this you will need to become familiar with navigating the directory structure.

If for example you were in the directory C:\DOS and wished to change to the C:\APPS directory this could be done in two ways (fig 2-6).

you could type at the prompt cd \ this would take you up one level from the directory C:\DOS to the root C: you could then type cd apps and you would find yourtop in the C:\APPS directory.

You could however achieve the same thing in a less time consuming way. Assuming you are in the C:DOS directory you could type cd \apps this command takes you directly to the C:\APPS directory.

Fig2-6 A simple directory structure

In Fig 2-7 we have a more complex directory structure.To change directory from C:\FILES\WORK toC:\APPS\WP may be done in a similar way to the example above, by typing cd c:\apps\wp howeverwe can, should we wish achieve this by either changing directory to the root (C:) using the ‘\’ switch as in cd\ or by changing up one level at a time using the ‘..’, as in cd..


The sequence of commands at the prompt C:\FILES\WORK would be:
cd.. This would take us to the FILES directory
cd..
This places us at the root (C:)
cd apps moves us down into the APPS directory
cd wp puts us in the WP directory

Alternately typing cd\apps\WP will work if you are familiar (can remember) the directory structure of your PC.

Fig2-7 A more complex directory structure

Windows95 and later


Windows95, while not actually changing the ‘pyramidic’ drive/directory structure, gave the impression that it had by introducing the concepts of ‘My Computer’ and ‘Network Neighbourhood’, with the introduction of the ‘Desktop’ (Fig 2-8). Apple Macintosh users had been familiar with the Desktop for perhaps ten years prior to the introduction of Windows95, however any fixed (SCSI) drives had always appeared on the Desktop.

It also allowed, should you be connected to a network, access to other computers on that network , via Network Neighbourhood’.

Fig 2-8 The Windows Desktop

From Windows 95, access to utilities such as the ‘Control Panel’ was at the same level as the local or networked drives (Fig 2-9)

Fig 2-9

File manipulation commands in DOS mode

There are a number of useful commands which can be issued at the DOS prompt. Given an understanding of those commands you can speed up simple tasks such as deleting unwanted files. moving groups of files from one location to another, or copying files.

If for example you wanted to copy all the files, as a backup, from C:/files to H:/ files (perhaps a networked drive) the steps would be;

 

In Windows

 

In DOS

  (assuming a start from the desktop)   (assuming a start from the desktop)
       
  (1)Move the cursor over My computer and click   (1)Move the cursor over the 'Start' button and click
  (2)Move the cursor over the 'C:' drive and click   (2)Select 'Run' and click
  (3)Move the cursor over the 'Edit' and 'right click'   (3)type cmd and hit return on the keyboard
  (4)Move the cursor over the 'Select all' and click   (4)type copy C:\files\*.* /s H:\files /y
  (5)Move the cursor over 'Copy' and click   --------------------------------------DONE-------------------------------------
  (6)Move the cursor over the 'Address bar' 'down arrow' and click  

   The Winner

  (7)Move the cursor over 'H: drive and 'click'   Note The /s switch means and subdirectories,
  (8)Move the cursor over 'Edit' and click   the /y (yes) means perform the task without warning me about
  (9)Move the cursor over 'Paste' and click   overwriting older files with the same name.
  (10) In the 'Conform Folder Replace' box click on 'Yes to all'  

 

  -----------------------------------DONE-----------------------------------    

The major commands and their usage are listed below.

DEL


Deletes one or more files from the location you specify.

Syntax

del [drive:][path]filename

As del c:\temp *.* /y

by default you will be asked to confirm this operation

 

DELTREE

Deletes a Directory, any subdirectories, and any files in those directories.

Syntax

deltree [drive:][path]filename
by default you will be asked to confirm this operation.

CD or CHDIR


Changes directory to the one specified and displays the name of the current directory if the prompt is set to $p$g in the autoexec.bat file

CD [drive:][path]
CD.. changes directory up one level
CD\ changes directory up to the root of the drive.
[drive:][path]
Specifies the drive (if other than the current drive) and directory to which you want to change.

 

COPY

Copies one or more files to the location you specify

This command can also be used to combine files. When more than one file is copied, MS-DOS displays each filename as the file is copied

Syntax

COPY [source] [destination]

source

Specifies the location and name of a file or set of files from which you want to copy. Source can consist of a drive letter and colon, a directory name, a filename, or a combination.

Destination

Specifies the location and name of a file or set of files to which you want to copy. Destination can consist of a drive letter and colon, a directory name, a filename, or a combination.

Switches

/Y

Indicates that you want COPY to replace existing file(s) without prompting you for confirmation.

Copies directories, their subdirectories, and files (except hidden and system files).

With this command, you can copy all the files in a directory, including the files in the subdirectories of that directory.

Syntax

XCOPY source [destination][/S]

source

Source must include either a drive or a path to the location and names of the files you want to copy..

destination

Specifies the destination of the files you want to copy. Destination can include a drive letter and colon, a directory name, a filename, or any combination.

Switches

/Y

Indicates that you want XCOPY to replace existing file(s) without prompting you for confirmation.

/S

Copies directories and subdirectories, unless they are empty. If you omit this switch, XCOPY works within a single directory

 

MOVE

Moves one or more files to the location you specify.

Syntax

MOVE [/Y|/-Y] [drive:][path]filename[,[drive:][path]filename[...]] destination

[drive:][path]filename

Moving a file to an existing file overwrites the existing file.

Switches

/Y

Indicates that you want MOVE to replace existing file(s) without prompting you for confirmation

MKDIR (MD)

Creates a directory.

Syntax

MKDIR [drive:]path

MD [drive:]path

RMDIR (RD)

Deletes a directory.

Syntax

RMDIR [drive:]path

RD [drive:]path

This command will not work on a directory with files in it. Should you wish to remove such a directory use deltree instead.

 

Other DOS Commands

AT

The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]

AT [\\computername] time [/INTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted.

id Is an identification number assigned to a scheduled command.

/delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled.

/yes Used with cancel all jobs command when no further confirmation is desired.

time Specifies the time when command is to run.

/interactive Allows the job to interact with the desktop of the user who is logged on at the time the job runs.

/every:date[,...] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed.

/next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed.

"command" Is the Windows NT command, or batch program to be run.

ATTRIB

Displays or changes file attributes.


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.
/S Processes matching files in the current folder and all subfolders.
/D Processes folders as well.

 

CHKDSK (Checkdisk)

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 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.

/R Locates bad sectors and recovers readable information (implies /F).

/L:size NTFS only: Changes the log file size to the specified number 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.

/C NTFS only: Skips checking of cycles within the folder structure.

 

CMD

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] [[/S] [/C | /K] string]

/C Carries out the command specified by string and then terminates

/K Carries out the command specified by string but remains

/S Modifies the treatment of string after /C or /K (see below)

/Q Turns echo off

/D Disable execution of AutoRun commands from registry (see below)

/A Causes the output of internal commands to a pipe or file to be ANSI

/U Causes the output of internal commands to a pipe or file to be Unicode

/T:fg Sets the foreground/background colors (see COLOR /? for more info)

/E:ON Enable command extensions (see below)

/E:OFF Disable command extensions (see below)

/F:ON Enable file and directory name completion characters (see below)

/F:OFF Disable file and directory name completion characters (see below)

/V:ON Enable delayed environment variable expansion using c as the delimiter. For example, / V:ON would allow !var! to expand the variable var at execution time. The var syntax expands variables at input time, which is quite a different thing when inside of a FOR loop.

/V:OFF Disable delayed environment expansion.

Note that multiple commands separated by the command separator ‘&&’ are accepted for string if surrounded by quotes. Also, for compatibility reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the same as /C. Any other switches are ignored.

If /C or /K is specified, then the remainder of the command line after the switch is processed as a command line, where the following logic is used to process quote (") characters:

1. If all of the following conditions are met, then quote characters

on the command line are preserved:

- no /S switch

- exactly two quote characters

- no special characters between the two quote characters, where special is one of: &<>()@^|

- there are one or more whitespace characters between the the two quote characters

- the string between the two quote characters is the name of an executable file.

2. Otherwise, old behavior is to see if the first character is a quote character and if so, strip the leading character and remove the last quote character on the command line, preserving any text after the last quote character.

COMMAND.

Starts the MS-DOS command interpreter.

COMMAND [[drive:]path] [device] [/E:nnnnn] [/P] [/C string] [/MSG]

[drive:]path Specifies the directory containing COMMAND.COM file.

device Specifies the device to use for command input and output.

/E:nnnnn Sets the initial environment size to nnnnn bytes.

/P Makes the new command interpreter permanent (can’t exit).

/C string Carries out the command specified by string, and then stops.

/MSG Specifies that all error messages be stored in memory. You need to specify /P with this switch.

DIR

Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/S]

[/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]

Specifies drive, directory, and/or files to list.

/A Displays files with specified attributes.

attributes are:

D Directories

R Read-only files

H Hidden files

A Files ready for archiving

S System files

/B Uses bare format (no heading information or summary).

/C Display the thousand separator in file sizes. This is the default. Use /-C to disable display of separator.

/D Same as wide but files are list sorted by column.

/L Uses lowercase.

/N New long list format where filenames are on the far right.

/O List by files in sorted order.

sortorder

N By name (alphabetic)

S By size (smallest first)

E By extension (alphabetic)

D By date/time (oldest first)

G Group directories first

/P Pauses after each screenful of information.

/Q Display the owner of the file.

/S Displays files in specified directory and all subdirectories.

/T Controls which time field displayed or used for sorting timefield

C Creation

A Last Access

W Last Written

/W Uses wide list format.

/X This displays the short names generated for non-8dot3 file names. The format is that of /N with the short name inserted before the long name. If no short name is present, blanks are displayed in its place.

/4 Displays four-digit years

Switches may be preset in the DIRCMD environment variable. Override preset switches by prefixing any switch with - (hyphen)--for example, /-W.

DOSKEY

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.

EDIT


Starts the MS-DOS text editor


[/B] [/H] [/R] [/S] [/<nnn>] [/?] [file(s)]
/B - Forces monochrome mode.
/H - Displays the maximum number of lines possible for your hardware.
/R - Load file(s) in read-only mode.
/S - Forces the use of short filenames.
/<nnn> - Load binary file(s), wrapping lines to <nnn> characters wide.
/? - Displays this help screen.
[file] - Specifies initial files(s) to load. Wildcards and multiple filespecs can be given

FORMAT


Formats a disk for use with Windows


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] [/1] [/4]


FORMAT volume [/Q] [/1] [/4] [/8]
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).
/V:label Specifies the volume label.
/Q Performs a quick format.
/C Files created on the new volume will be compressed by default.
/X Forces the volume to dismount first if necessary. All opened handles to the volume would no longer be valid.
/A:size Overrides the default allocation unit size. Default settings are strongly recom mended 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:
FAT: Number of clusters <= 65526
FAT32: 65526 < Number of clusters < 268435446
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.
/F:size Specifies the size of the floppy disk to format (160,180, 320, 360, 640, 720, 1.2, 1.23, 1.44, 2.88, or 20.8).
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/1 Formats a single side of a floppy disk.
/4 Formats a 5.25-inch 360K floppy disk in a high-density drive.
/8 Formats eight sectors per track.

MORE

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
Copies files and directory trees.

XCOPY

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/H] [/R]

[/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]...]
source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set, doesn't change the attribute.
/M Copies only files with the archive attribute set,turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time.


/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the
directory obj or all files with the .obj extension respectively.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
/V Verifies each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file, assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories. /T /E includes empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/N Copies using the generated short names.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an existing destination file.
/-Y Causes prompting to confirm you want to overwrite an existing destination file.
/Z Copies networked files in restartable mode.


The switch /Y may be preset in the COPYCMD environment variable.This may be over-ridden with /-Y on the command line.

Learning The DOS commands is a great way of saving time, gives you an insight into the commands behind all the mouse wiggling, impresses the natives and makes you feel like a proper Anorak!.

 

© Allen. C. Roffey 11:55 17/09/2005