Archive

Posts Tagged ‘pscp’

Use PSCP from Windows to copy files to network devices and Linux servers

January 6, 2011 8 comments

PuTTYI just had a question asking how I get files to/from network devices and Linux servers originating from a Windows machine. For this I use PSCP, which is a part of the PuTTY set of utilities. I use PSCP for two reasons:

  1. FTP is dead, stop using it!!! SCP, SFTP or other similar protocols should be used for transferring files! If your network devices are only setup for FTP or TFTP then get them configured correctly!! (The same goes for telnet, start using SSH!)
  2. Its command line driven. This makes it quick/easy to use and script with.

That said I would recommend downloading and installing the Windows installer version of PuTTY from the download page. This will insure you have all of the binaries and help file available in your start menu, this is not required for operation however. The PuTTY installer does not update the path environment so PSCP can be run from anywhere.  To use PSCP from anywhere in the command line you will either need to use the full path for the executable every time or add the correct path statement.

Here are the steps for adding the path with Win7 (pretty much the same for other versions of Windows):

  1. Go to the Start Menu and right-click on computer.
  2. Choose Properties.
  3. Click “Advanced System Settings”
  4. Click on the “Environmental Variables” button.
  5. In the “System Variables” section double-click on “Path”.
  6. Go to the end of the “Variable Value” blank and semi-colon and the path to where the PuTTY binaries are located. Here is the path statement I added for my 64-bit Win7 machine:
    ;C:\Program Files (x86)\PuTTY
    For a 32-bit Windows OS it would be:
    ;C:\Program Files\PuTTY
  7. Click OK out of all these screens and reboot.

You will now be able to use any of the PuTTY binaries (including PSCP) from the command line without using the full path.

Using PSCP is pretty easy. Just type PSCP without any options to see the usage.

Here is a sample upload via PSCP:

pscp test.file root@testhost:/tmp/

Here is a sample download via PSCP:

pscp root@testhost:/tmp/test.file .

If you’re not comfortable using the command line in Windows for file transfer then I would recommend WinSCP. But then if your working in network devices or Linux I would image you are OK with the command line.

Categories: Tools Tags: