Replace
Updated: January 21, 2005
Syntax
replace [Drive1:][Path1] FileName [Drive2:][Path2] [/p] [/r] [/s] [/w] [/u]
Parameters
Remarks
- Replace messages
As replace adds or replaces files, the file names are displayed on the screen. After the replace command is finished, a summary line is displayed in one of the following formats:
nnn files added nnn files replaced no file added no file replaced
- Replacing files on floppy disks
If you are using floppy disks and need to switch disks during the replace operation, you can specify the /w command-line option so that replace will wait for you to switch disks, as necessary.
- Limitations on replace
You cannot use the replace command to update hidden files or system files. For information about changing hidden and system attributes, click attrib in the Related Topics list.
- Replace exit codes
The following list shows each exit code and a brief description of its meaning:
Exit code Description 0 The replace command successfully replaced or added the files. 1 The replace command encountered an incorrect version of MS-DOS. 2 The replace command could not find the source files. 3 The replace command could not find the source or destination path. 5 The user does not have access to the files you want to replace. 8 There is insufficient system memory to carry out the command. 11 The user used the wrong syntax on the command line. You can use the ErroLevel parameter on the if command line in a batch program to process exit codes returned by replace. For an example of a batch program that processes exit codes, click if in the Related Topics list.
Examples
replace a:\phones.cli c:\ /s
To add new printer device drivers to a directory on drive C named Tools, which already contains several printer device-driver files for a word processor:
replace a:*.prd c:\tools /a
This command searches the current directory on drive A for any files that have the extension .prd and then adds these files to the Tools directory on drive C. Because the /a command-line option is included, replace adds only those files from drive A that do not exist on drive C.
Formatting legend
Format | Meaning |
Italic | Information that the user must supply |
Bold | Elements that the user must type exactly as shown |
Ellipsis (...) | Parameter that can be repeated several times in a command line |
Between brackets ([]) | Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one |
Courier font | Code or program output |