REPLACE – Windows CMD Command

Replace one file with another (both having the same filename).

When replacing in all subdirectories (/S ) the files in the source are matched against every subfolder, this is not a mirror, the files in each folder are matched separately.
The (/S ) subdirectories option cannot be combined with Add files (/A) or Restrict to Updating older (/U).

REPLACE will list all the files that are replaced. By default, only files that already exist in the destination will be replaced.

You cannot use REPLACE to update any file which has a hidden or system attribute set, see the ATTRIB command for more.

REPLACE will set %ERRORLEVEL% as follows:

0 0 or more files were replaced.
3 Source or destination not found.
5 Access denied.
11 Invalid switch.

The path to the destination folder must NOT include a trailing backslash.

Examples

Update the report.doc file in all the folders beneath C:\reports :

You may also like...

1 Response

  1. zortilo nrel says:

    There’s noticeably a bundle to know about this. I assume you made sure nice factors in options also.

Leave a Reply

Your email address will not be published. Required fields are marked *