Quincy Center for Technical Education
Computer Technology Department

Replace

Replaces files in the destination directory with files in the source directory that have the same name. You can also use replace to add unique file names to the destination directory.

replace [drive1:][path1] filename [drive2:][path2] [/a] [/p] [/r] [/w]

replace [drive1:][path1] filename [drive2:][path2] [/p] [/r] [/s] [/w] [/u]

Parameters

[drive1:][path1] filename

Specifies the location and name of the source file or set of files.

[drive2:][path2]

Specifies the location of the destination file. You cannot specify a file name for files you replace. If you specify neither a drive nor a directory, replace uses the current drive and directory as the destination.

/a

Adds new files to the destination directory instead of replacing existing files. You cannot use this switch with the /s or /u switch.

/p

Prompts you for confirmation before replacing a destination file or adding a source file.

/r

Replaces read-only files as well as unprotected files. If you do not specify this switch but attempt to replace a read-only file, an error results and stops the replacement operation.

/w

Waits for you to insert a disk before replace begins to search for source files. If you do not specify /w, replace begins replacing or adding files immediately after you press ENTER.

/s

Searches all subdirectories of the destination directory and replaces matching files. You cannot use the /s switch with the /a switch. The replace command does not search subdirectories specified in path1.

/u

Replaces (updates) only those files on the destination directory that are older than those in the source directory. You cannot use the /u switch with the /a switch.