2020-10-06 16:49:43 +01:00
|
|
|
# replace
|
|
|
|
|
|
|
|
> Replace files.
|
|
|
|
> See also: `robocopy`, `move`, `copy`, and `del`.
|
2022-10-04 16:06:23 +01:00
|
|
|
> More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/replace>.
|
2020-10-06 16:49:43 +01:00
|
|
|
|
|
|
|
- Replace the destination file with the one from the source directory:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`replace {{path\to\file_or_directory}} {{path\to\destination_directory}}`
|
2020-10-06 16:49:43 +01:00
|
|
|
|
|
|
|
- Add files to the destination directory instead of replacing existing files:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /a`
|
2020-10-06 16:49:43 +01:00
|
|
|
|
|
|
|
- Interactively copy multiple files, with a prompt before replacing or adding a destination file:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /p`
|
2020-10-06 16:49:43 +01:00
|
|
|
|
|
|
|
- Replace even read only files:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /r`
|
2020-10-06 16:49:43 +01:00
|
|
|
|
|
|
|
- Wait for you to insert a disk before it replaces files (originally to allow inserting a floppy disk):
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /w`
|
2020-10-06 16:49:43 +01:00
|
|
|
|
2021-01-10 19:29:22 +00:00
|
|
|
- Replace all files in subdirectories of the destination:
|
2020-10-06 16:49:43 +01:00
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /s`
|
2020-10-06 16:49:43 +01:00
|
|
|
|
|
|
|
- Replace only files in the destination directory which are older than the files in the source directory:
|
|
|
|
|
2023-02-20 07:23:49 +00:00
|
|
|
`replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /u`
|
2020-10-06 16:49:43 +01:00
|
|
|
|
|
|
|
- Display detailed usage information:
|
|
|
|
|
|
|
|
`replace /?`
|