I'm using the command scp -P${myport} ${username}@${ip} to tranfer the files, but I don't know how to write the filepath in windows. For example, if the filepath in windows isC:/Download, how to write the scp command?

  • 1
    "to write the filepath in windows." That would be a windows problem and not Ubuntu. I tend to use putty for things like this.
    – Rinzwind
    Mar 18, 2019 at 13:09
  • Instead of scp from Ubuntu to Win10, you might consider using Win10 to take files from Ubuntu; then, you can use programs like Filezilla.
    – Ray
    Mar 18, 2019 at 15:30
  • @Rinzwind Actually, Putty is for terminal access and this post is about file transfers, so not really related.
    – Ray
    Mar 18, 2019 at 15:31
  • 1
    @ray no not true. putty is commandline too in windows. executable is called pscp (putty scp) Here is the manual ssh.com/ssh/putty/putty-manuals/0.68/Chapter5.html But again this is a WINDOWS problem
    – Rinzwind
    Mar 18, 2019 at 15:36
  • 1
    see the link. putty is also command line pscp c:\documents\foo.txt fred@example.com:/tmp/foo
    – Rinzwind
    Mar 18, 2019 at 15:47

1 Answer 1


If we talking about the new feature of the latest Windows build: OpenSSH in Windows, you just need to quote the Windows path, because it usually contains colon sign :, that in general is used to indicate the remote host within scp, rsync, etc.

So to copy a file from (local)Ubuntu to (remote)Window you can use a command as:

scp ./test.txt user@windows-host:'D:\Downloads\'

To copy a file from (remote)Window to (local)Ubuntu you need to add the option -T (explanation) then the command will look as:

scp -T user@windows-host:'D:\Downloads\test.txt' ./    
scp -T user@windows-host:'D:\Downloads\*.*' ./
  • scp user@191.x.x.x:D:/\Projects/\test/\test.rar . worked for me
    – Adiii
    Mar 25, 2020 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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