REPLACE

The description below is from the book
DOS the Easy Way by Everett Murdock Ph.D.

CLICK HERE for information about downloading the book.

Type: External (3.2 and later)

Syntax:

REPLACE [d:][path]filename [d:][path][/A][/P][/R][/S][/U][/W]

Purpose: Replaces stored files with files of the same name from a different storage location.

Discussion

This command replaces files in the target path designation with files of the same name in the source location.
You can use wildcard characters (? and *) to indicate groups of filenames in the source directories. You cannot use this command to replace hidden files or system files.
As files are replaced, the program displays their filenames on the screen. After the replace operation is complete, it displays

n file(s) added/replaced


After this command terminates, it sets one of the following exit codes:
0 - Command completed successfully
1 - Command line error
2 - File not found
3 - Path not found
5 - Access denied
8 - Insufficient memory available
15 - Invalid drive


Options

/A - Adds files specified by the source path designation that DO NOT exist on the target path designation. By using this option, you can selectively add files to a directory: a file in the source path designation that has the same name as a file on the target designation will not be affected.

This option cannot be used in combination with the /S option.

/P - Displays a prompt before each file is replaced allowing you to decide on a file-by-file basis whether or not to allow the replacement.

/R - Replaces both read-only and unprotected files on the target directory. Without this option, any attempt to REPLACE a read-only file will result in an error message and the replacement process will terminate.

/S - Acts both on the target directory and all subdirectories within the target directory. You cannot use the /A option together with this option.

/U - Replaces files on the target drive or directory that are older than their counterparts on the source drive.

/W - Waits for you to insert a disk before starting the replacement process.

Examples

To replace all copies of the file MAIN.EXE on all directories within the root directory of drive C with a file of the same name that is stored in the SPECIAL directory on drive A, enter

a: \special\main.exe c:\/s

To add all files from the NEWFILES directory on drive A that have the .PCX filename extension to the FILES directory on drive C (as long as no file of the same name already exists there), enter

a:\newfiles\*.pcx c:\files/a




Back to the Easy DOS Command Index