Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)?

share|improve this question

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

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

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer

Try scp "/c/myfile.txt" user@host:path

share|improve this answer
    
Welcome to Super User! Thanks for your contribution but your answer adds nothing to krock's answer from five years ago. Having multiple answers that say the same thing just clutters up the page. –  David Richerby May 30 at 14:48
    
@DavidRicherby: If you look closely, you'll see that Darien is suggesting a variation that's slightly different from any of the ones that krock listed.  This might have been better handled as a comment (since Darien does have commenting privileges), but "your answer adds nothing" seems a little harsh. –  G-Man May 30 at 20:30
2  
@G-Man Perhaps I was over-hasty. However, this answer would be greatly improved by an explanation of how it differs from the superficially near-identical prior answer and in what circumstances this answer can be expected to work. –  David Richerby May 30 at 20:51

Your Answer

 
discard

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.