I'm trying to run SCP on my Windows box through a batch file.

I want to do something like:

scp "C:\myfile.txt" user@host:path

Of course scp thinks that "C" is my source host and "\myfile.txt" is my source path. I can't seem to find a way to escape the colon.

These don't work:

scp "C\:\myfile.txt" user@host:path
scp "C::\myfile.txt" user@host:path
scp "C^:\myfile.txt" user@host:path

SCP man pages suggest that using the "absolute or relative pathname" should eliminate this problem but I'm using the absolute pathname and this is still an issue. They likely mean it eliminates the problem on *nix where absolute and relative pathnames start with "/" or ".".

Suggestions (aside from throwing my Windows box off the freaking roof)?

link|improve this question
feedback

migrated from stackoverflow.com Jun 2 '11 at 0:38

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

2 Answers

If your working dir is in C: you should be able to specify \myfile.txt. If you are using MinGW you could try \c\myfile.txt. If you are using cygwin then /cygdrive/c/myfile.txt should work.

link|improve this answer
feedback

You could use pscp, though. The PuTTY author seems to put a lot more effort into making sure that his programs run on Windows while many native Unix software gets ported very poorly, as you note.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown