Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2


Copies files between a computer running Windows XP or a Windows Server 2003 operating system and a system running rshd, the remote shell service (daemon). The Windows Server 2003 family, Windows XP, and Windows 2000 do not provide rshd service. Used without parameters, rcp displays help.


rcp[{-a | -b}] [-h] [-r] [Host][.User:] [Source] [Host][.User:] [Path\Destination]

  • -a
    Specifies ASCII transfer mode. This mode converts the end-of-line (EOL) characters to a carriage return for UNIX and a carriage return/line feed for computers. This is the default transfer mode.
  • -b
    Specifies binary image transfer mode. No carriage return/line feed conversion occurs.
  • -h
    Transfers source files that are marked with the hidden attribute to the computer running Windows XP or a Windows Server 2003 operating system. Otherwise, hidden files are not copied.
  • -r
    Recursively copies to the destination the contents of all subdirectories of the source.
  • Host
    Specifies the local or remote host. If Host is specified as an IP address or if the host name contains dots (.), you must specify the user.
  • User
    Specifies the user name. If the user name is not specified, the name of the user who is currently logged on is used.
  • Source
    Specifies the files to copy.
  • Path\Destination
    Specifies the path relative to the logon directory on the remote host. Use the backslash (\), quotation mark ("), or apostrophe (‘) escape characters in remote paths to use wildcard characters on the remote host. If multiple source files are specified, the destination is a directory.
  • /?
    Displays help at the command prompt.
  • Third-party transfers

    The rcp command, a connectivity command, can also be used for third-party transfers. You can run the rcp command from a to copy files between two other computers that are running rshd. The rshd daemon is available on UNIX computers, so computers running Windows XP or Windows Server 2003 operating systems can participate in a third-party transfer only as the system from which the commands are run.

  • Using the -r parameter

    Both the Source and Path\Destination must be directories. However, you can use -r without recursion if the source is not a directory.

  • Using the Source and Path\Destination parameters

    If the file name does not begin with a forward slash (/) for UNIX or a backslash (\) for Windows XP and the Windows Server 2003 family, it is assumed to be relative to the current working directory. On computers running Windows XP or Windows Server 2003 operating systems this is the directory from which the command is run. On the remote system, it is the logon directory for the remote user. A period (.) indicates the current directory. You can use the backslash (\), quotation mark ("), or apostrophe (‘) escape characters in remote paths as wildcard characters on the remote computer.

  • Remote access permissions

    The rcp command does not prompt for passwords. The current or specified user name must exist on the remote computer and allow remote command execution with rcp.

  • The .rhosts file

    The .rhosts file specifies which remote systems or users can access a local account using rsh or rcp. This file (or a Hosts equivalent) is required for access to a remote system using these commands. Both the rsh and rcp commands transmit the local user name to the remote system. The remote system uses this name and the IP address (usually resolved to a computer name) of the requesting system to determine whether access is granted. There is no provision for specifying a password to access an account using these commands.

    If the user is logged on to a domain, the primary domain controller must be available to resolve the logon name because it is not cached on the local computer. Because the user name is required as part of the rsh protocol, the command fails if it cannot be obtained.

    The .rhosts file is a text file in which each line is an entry. An entry consists of the local computer name, the local user name, and any comments about the entry. Each entry is separated by a tab or space, and comments begin with a pound sign (#), for example:

    computer5marie #This computer is in room 31A

    The .rhosts file must be in the user's home directory on the remote computer. For more information about the specific implementation of the .rhosts file on a remote computer, see the remote system documentation.

    Additionally, you can add your computer name to the /Etc/Hosts file on the remote computer. This allows the remote system to authenticate remote requests for your computer when you use the Windows Server 2003 family TCP/IP utilities.

  • Specifying computers (hosts)

    Use the Computer**.User parameters to use a user name other than the current one. If Computer.**User is specified with Source, the .rhosts file on the remote computer must contain an entry for User, as follows:

    rcp host99.user7:file1 corp7.admin:file2

    The .rhosts file on corp7should have an entry for user7on host99.

    If a computer name is supplied as a full domain name containing dots, a user name must be appended to the computer name, as previously described. This prevents the last part of the domain name from being interpreted as a user name, as follows:

    rcp domain-name1.user:user92 domain-name2.user:user7

  • Remote processing

    Remote processing is performed by a command that is run from the user logon shell on most UNIX systems. The .profile or .cshrc of the user is executed before parsing file names, and exported shell variables can be used (using the escape character or quotation marks) in remote file names.

  • Copying Files

    If you attempt to copy a number of files to a file rather than a directory, only the last file is copied. The rcp command cannot copy a file onto itself (the Source and Path/Destination cannot be the same.)

    If you have logged onto the computer running Windows XP or a Windows Server 2003 operating system using a domain other than the local one, and the primary domain controller is unavailable, the command fails because rcp cannot determine the local user name. The same restriction applies to rsh.

  • This command is available only if the Internet Protocol (TCP/IP) protocol is installed as a component in the properties of a network adapter in Network Connections.


To copy a local file to the logon directory of a remote computer, type:

rcp filename remotecomputer:

To copy a local file to an existing directory with a new file name on a remote computer, type:

rcp filename remotecomputer:/directory/newfilename

To copy multiple local files to the subdirectory of a remote logon directory, type:

rcp file1 file2 file3 remotecomputer:subdirectory/filesdirectory

To copy from a remote source to the current directory of the local computer, type:

rcp remotecomputer:filename

To copy multiple files from multiple remote sources to a remote destination with different user names, type:

rcp remote1.user1:file1 remote2.user2:file2 remotedest.destuser:directory

Formatting legend

Format Meaning


Information that the user must supply


Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also


Command-line reference A-Z
Command shell overview