PSCP – PuTTY Secure Copy for Windows
PSCP (pscp.exe) is the command-line secure copy tool in the PuTTY suite for Windows. It transfers files between a Windows machine and Linux or Unix servers over an SSH-encrypted connection — using the same authentication method as PuTTY SSH sessions, including keys managed by Pageant. PSCP putty syntax is compatible with standard SCP clients.
Download PSCP
PSCP is available as a standalone executable from the official PuTTY release page:
chiark.greenend.org.uk – pscp.exe standalone download
Basic PSCP Syntax
pscp [options] source destination
# Uploading (Windows → Server):
pscp [options] local-file user@host:remote-path
# Downloading (Server → Windows):
pscp [options] user@host:remote-file local-pathCommon Command-Line Switches
| Switch | Description |
|---|---|
-P port | Connect on a non-standard SSH port. |
-i key.ppk | Use a specific PPK private key file for authentication. |
-r | Recursive copy — transfer entire directory trees. |
-p | Preserve file timestamps and permissions from the source. |
-q | Quiet mode — suppress progress meter output. |
-batch | Non-interactive: abort rather than prompt for passwords or host keys. |
-scp | Force use of SCP protocol (vs. SFTP). |
-sftp | Force use of SFTP protocol (more reliable for large/complex transfers). |
-pw password | Password authentication (insecure — prefer key-based auth). |
-agent | Use keys from a running Pageant agent. |
-hostkey fingerprint | Accept a specific host key fingerprint (for scripting). |
Upload a File to a Remote Server
# Upload a single file
pscp -i "C:keysserver.ppk" report.pdf admin@192.168.1.10:/home/admin/reports/
# Upload with key from Pageant (no -i needed if Pageant is running)
pscp report.pdf admin@192.168.1.10:/home/admin/reports/
# Upload to a specific non-default SSH port
pscp -P 2222 -i "C:keysserver.ppk" config.yaml user@example.com:/etc/app/Download a File from a Remote Server
# Download a single file to current directory
pscp admin@192.168.1.10:/var/log/app.log .
# Download to a specific local path
pscp admin@192.168.1.10:/var/log/app.log "C:Logsapp.log"
# Download and preserve timestamps
pscp -p admin@192.168.1.10:/var/www/backup.tar.gz "D:Backups"Recursive Directory Transfer
# Upload entire directory to remote server
pscp -r "C:Deployapp" user@example.com:/var/www/app/
# Download entire remote directory
pscp -r user@example.com:/var/www/app/ "C:LocalBackupapp"Automated File Transfer in Batch Scripts
Use -batch to prevent the script from hanging on interactive prompts. Pre-accept the host key by connecting with PuTTY first, or use -hostkey to specify it:
@echo off
:: Automated backup script
pscp -batch -i "C:keysackup.ppk" ^
user@backup.example.com:/var/backups/db_dump.sql ^
"D:Backupsdb_dump_%DATE:~-4,4%%DATE:~-10,2%%DATE:~-7,2%.sql"
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Backup download failed >> backup.log
exit /b 1
)
echo Backup successful >> backup.logUsing Wildcards to Transfer Multiple Files
# Download all .log files from a remote directory
pscp admin@example.com:"/var/log/*.log" "C:Logs"
# Note: When using wildcards, quote the remote path to prevent local shell expansion
# Wildcards are evaluated on the remote server by the SCP/SFTP subsystemPSCP vs. PSFTP
| Tool | Protocol | Best For |
|---|---|---|
pscp.exe | SCP / SFTP | Single file transfers, batch scripts, automation pipelines. |
psftp.exe | SFTP | Interactive file management, browsing directories, resuming transfers. |
Tip: For scripted automation, PSCP is preferable because it exits with a status code that batch scripts and CI pipelines can check. Use PSFTP for interactive sessions where you need to navigate and manage remote directories.
Security Best Practices
- Always use key-based authentication (
-i key.ppkor Pageant) instead of-pw. - Use
-batchin automated scripts to prevent hanging on unexpected prompts. - Restrict the SSH user account on the server to only the directories it needs access to.
- Consider using
chrootjails orForceCommandinsshd_configto limit server-side access for automated file transfer accounts.