Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ replace(CMD) — OpenDesktop 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


 replace(CMD)                    19 June 1992                    replace(CMD)


 Name

    replace - replace files in the destination directory with files in the
    source directory

 Syntax


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

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


 Description

    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 filenames to the destination directory.

 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 filename for files you replace.  If you specify neither a drive
         nor a directory, replace uses the current drive and directory as the
         destination.


 Switches


    /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.

    /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 speci-
         fied in path1.

    /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.

    /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.


 Notes


    replace messages

    As replace adds or replaces files, MS-DOS displays their filenames on the
    screen. After the replace command is finished, MS-DOS displays a summary
    line in one of the following formats:

       nnn files added
       nnn files replaced

       no file added
       no file replaced


    Replacing files on a floppy disk system

    If you have a floppy disk system and need to switch disks during the
    replace operation, you can specify the /w switch so that replace will
    wait for you to switch disks, as necessary.

    Limitations on replace

    You cannot use the replace command to update hidden files or system files
    such as IO.SYS and MSDOS.SYS.  For information about changing hidden and
    system attributes, see the attrib(CMD) command.

    replace exit codes

    The following list shows each exit code and a brief description of its
    meaning:

    0    replace successfully replaced or added the files.

    2    replace could not find the source files.

    3    replace could not find the source or destination path.

    5    The user does not have access to the files you want to replace.

    8    There is insufficient system memory to carry out the command.

    11   The user used the wrong syntax on the command line.

    You can use the errorlevel parameter on the if command line in a batch
    program to process exit codes returned by replace.  For an example of a
    batch program that processes exit codes, see the backup(CMD) command.

 Examples

    Suppose that several directories on drive C contain different versions of
    a file named PHONES.CLI, which contains client names and phone numbers.
    To replace all of these files with the latest version of the PHONES.CLI
    file from the disk in drive A, type the following command:

       replace a:\phones.cli c:\ /s


    Suppose you want to add new printer device drivers to a directory on
    drive C named TOOLS, which already contains several printer device-driver
    files for a word processor.  To do this, type the following command:

       replace a:*.prd c:\tools /a


    This command searches the current directory on drive A for any files that
    have the extension .PRD and then adds these files to the TOOLS directory
    on drive C.  Because the /a switch is included, replace adds only those
    files from drive A that do not exist on drive C.

 Related command

    For information about changing file attributes, see the attrib(CMD) com-
    mand.


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026