Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was trying to copy a file from remote server using SCP but its giving the following error.

bash-3.2$ scp username@server:main.php C:\main.php

ssh: Could not resolve hostname C: hostname nor servname provided, or not known

Its assuming C: as hostname but its just the drive name..Please let me how to specify explicitly like some escaping to get rid of this issue.

If i don't specify the path where to save on local desktop,its working fine.

bash-3.2$ scp username@server:main.php main.php
main.php                                                                   100%   29KB  28.9KB/s   00:01

Appreciate any help.. Thanks in advance,

PS: Using Windows XP SP2

share|improve this question

migrated from Jun 2 '11 at 0:52

This question came from our site for professional and enthusiast programmers.

4 Answers 4

up vote 7 down vote accepted

If you are using Cygwin's scp, you might try using the Cygwin paths:

scp user@host:main.php /cygdrive/c/main.php

You could also use the pscp and psftp commands included in the PuTTY package – they are native Win32 programs and won't complain about Windows paths.

Alternatively, WinSCP is a good SCP/SFTP client (primarily a GUI, though also comes with a command-line tool).

share|improve this answer
It's actually /cygdrive/c . – Adam Rosenfield Jun 4 '09 at 18:44
Ah, thanks. [updates] – grawity Jun 4 '09 at 18:45
Thanks for the recommended GUI. Please note that WinSCP allows you to alter the editor you use with it and will work in conjunction with emacsclientw. – Giles Roberts Jan 21 '13 at 11:56
@grawity Actually you were correct before. It is /cygdrive/c by default, but many cygwin users run mount --change-cygdrive-prefix / so that it is /c instead (/d etc) as it's much easier to type ;) – DavidPostill Jun 10 at 15:00

Use PSCP.exe

The problem you are having is because you are referencing your windows xp drive from the shell which you cannot do. You are logged on remotely to a machine so unless your windows xp box has a ssh server running in which case you would use login and pw info for the destination location, you will cannot do that.

Using pscp.exe (free) you can do what you want.

share|improve this answer
Thanks for all your quick help. pscp solved my problem. – Naga Kiran Jun 4 '09 at 19:22

@grawity is right. In the future, you can run also


to find out what directory you're in, so that you can figure out the correct path to the directory you want according to cygwin.

share|improve this answer

I had the similar problem and had success using:

scp username@server:main.php /c/main.php

which is only sort of mentioned by the others.

share|improve this answer
Actually, isn't this exactly what discusses? Plus having been edited from /c/ to /cygdrive/c/ after it being pointed out that the latter is the correct form. – Michael Kjörling Nov 2 at 20:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.