replace [:] [] [:] [] [/ p] [/ r] [/ s] [/ w] [/ u]
Replace command parameter
Parameters
Describe
[:] []
Specify the location and name of the source file or set of files to replace.FileName is a required parameter and can include wildcards (* and?).
[:] []
Specify the location of the destination file.You cannot specify file names for files you want to replace.If you do not specify a drive or path, the replace command will use the current drive and directory as the destination file by default.
/ a
Add new files to the target directory instead of replacing existing files.You cannot use this command line option together with the command line option / s or / u .
/ p
Remind you to confirm before replacing a destination file or adding a source file.
/ r
Replace Read-only files and unprotected.If you try to replace a Read-only file, but you did not specify the / r parameter, the returned result will report an error and stop executing the replace command.
/ w
Wait for you to add a disk before the process of finding source files begins.If you do not specify the / w parameter, the replace command will start replacing or adding files immediately after you press ENTER.
/S
Search all subdirectories in the destination directory and replace the appropriate files.You cannot use the / s parameter with the command line option / a . The replace command will not search for subdirectories specified in Path1 .
/ u
Replace only the files on the target folder older than those in the source directory.You cannot use the / u parameter with the command line option / a .
/?
Show help at thecommand prompt.
Note the replace command
When the replace command adds or replaces files, the file name will be displayed on the screen. After the replace command is executed, a summary line will be displayed in one of the following formats:
nnn tập tin thêm nnn tập tin không thay thế tập tin thêm không có tập tin
If you are using a floppy disk and you need to convert the disk during the replacement process, you can specify the / w command line option to replace the replace command that will be suspended while you convert the disk.
You cannot use the replace command to update hidden files or system files.
The following table shows each exit code and a brief description of the meaning of these codes:
Exit code
Describe
0
The replace command has successfully replaced or successfully added the files.
first
The replace command encountered an incorrect MS-DOS version.
2
The replace command cannot find the source files.
3
The replace command cannot find the source or destination path.
5
Users do not have access to the files you want to replace.
8
There is not enough system memory to execute the command.
11
The user has used the wrong syntax on the command line.
Note:
You can use the ERRORLEVEL parameter on the if statement in a batch program to handle exit codes returned by the replace command.
For example the replace command
To update all versions of a file named Phones.cli (appearing in multiple folders on drive C), with the latest version of the Phones.cli file from the floppy disk in drive A, enter:
replace a: phones.cli c: / s
See more: