HOWTO · PowerShell

How to Copy Files From Windows to Linux Using PowerShell

Learn the command forms for copying files and folders from Windows to Linux with scp or PuTTY's pscp in PowerShell.

On this page

From a PowerShell prompt on Windows, you can copy files or folders to a Linux host with either scp or PuTTY’s pscp. The examples below are command templates: replace the sample names, host, account, and paths with values for your systems. They are not run here because a real transfer needs a reachable SSH server and an account you can authenticate with.

File transfer uses SSH to connect to the remote host; it is separate from PowerShell remoting. For either command, the selected client must be invocable from your prompt, and the Linux host must accept SSH connections for the account you use. These instructions do not require a particular installation method, operating-system release, PowerShell release, or client version.

Use scp Command to Copy Files From Windows to Linux in PowerShell

Use scp with a local source path followed by a remote destination in the form user@host:/remote/directory/. This single-file template copies test.txt from the current PowerShell directory into /home/delftstack/ on the example Linux host:

scp test.txt delftstack@ubuntu-PC:/home/delftstack/

The local source is test.txt; delftstack is the remote account and ubuntu-PC is the host name. The destination after the colon is a directory on that host. The client may prompt you to authenticate, depending on how SSH access is configured.

To copy a directory and its contents, add -r and use the directory as the source:

scp -r 'C:\New\complex' delftstack@ubuntu-PC:/home/delftstack/

Here, C:\New\complex is a local Windows path and /home/delftstack/ is the remote destination directory. If a source path contains spaces, quote the local path as shown by the shell syntax. For a remote path containing spaces, quote the remote path in a form accepted by your scp client and remote shell; the exact quoting can depend on the client and shell combination.

Use pscp Command to Copy Files From Windows to Linux in PowerShell

pscp is PuTTY’s command-line file transfer client and provides another way to transfer files over SSH. Make sure pscp is invocable from PowerShell. PuTTY’s download page provides its releases; this article does not prescribe a specific version or installation method.

The following template copies styles.csv from the current directory to a remote directory whose name contains a space:

pscp styles.csv 'delftstack@ubuntu-PC:/home/delftstack/New Folder'

The local source is styles.csv; the text before the colon identifies the remote account and host, and the path after it is the destination. Quoting the full remote specification keeps the space together as one argument in PowerShell. If your client or remote shell handles that path differently, use the quoting form required by that setup.

For a directory transfer, add -r before the source path:

pscp -r 'C:\record' delftstack@ubuntu-PC:/home/delftstack/

This copies the local C:\record directory to the remote /home/delftstack/ directory. In both tools, use -r for a directory tree; for one file, provide the file path without that option.

In short, use scp or PuTTY’s pscp from PowerShell with a local source and an SSH remote destination. Choose the client available in your environment, substitute your account and paths, and authenticate to the Linux host when prompted.