Windows command line arguments - problems with " and \ #464

left1000 opened this Issue Apr 30, 2016 · 8 comments


None yet

3 participants

left1000 commented Apr 30, 2016 edited

rclone copy -v --log-file=logfile.txt "F:" "remote:Windows Fat"

doesn't work at all, error makes no sense and for some reason rclone creates new folders inside it's own folder named Fat and Fat_

yet somehow
rclone copy -v --log-file=logfile.txt "F:\4" "remote:Windows Fat\4"
worked perfectly! but... ideally I'd like to backup this entire drive all at once and I have no idea why I can't

I very clumsily moved every single file from the F drive into a subfolder of F:\ called F and then the transfer copy command worked

I tried this in 1.27 and 1.29

oh in case it wasn't clear "Fat" is what I named the drive because it's in fat32 because I used it a long time ago. I'm not sure if that matters.

ncw commented Apr 30, 2016

After a quick look this does look like a bug. Rclone is treating "remote:Windows Fat" as a local directory rather than a remote. Will investigate further!


is it because I started with a root drive? or because of fat32? or windows keyword? either way it's baffling how simple the workaround is...

ncw commented Apr 30, 2016

I'm away from my computer at the moment - I'll check the source when I get back and all will become clear!


Use F:\ (no quotes).

However, there is something weird in the args parsing. "f:\" is not the same as f:\. Something is doing some escape-stuff. Windows explicitly claims not to do escape processing on \, so it may be some quirk with the flag parser.

ncw commented May 2, 2016

I think you must have written this originally

rclone copy -v --log-file=logfile.txt "F:\" "remote:Windows Fat"

In the pastebin the first line is

2016/04/29 20:35:26 Local file system at : Replacing invalid characters in "\" remote:Windows" to "F:_ remote_Windows"

indicating that Windows thought rclone was being run with two arguments

  • F:\" remote:Windows
  • Fat

So I think this is caused by oddities in the windows command line parser as Klaus suggested, so

rclone copy -v --log-file=logfile.txt F:\ "remote:Windows Fat"

Should fix it

This is caused ultimately by CommandLineToArgvW which states:

CommandLineToArgvW has a special interpretation of backslash characters when they are followed by a quotation mark character ("), as follows:

  • 2n backslashes followed by a quotation mark produce n backslashes followed by a quotation mark.
  • (2n) + 1 backslashes followed by a quotation mark again produce n backslashes followed by a quotation mark.
  • n backslashes not followed by a quotation mark simply produce n backslashes.

The original command line had a mis-matched quote " so it would have been nice if it had given an error.

@ncw ncw changed the title from I'm sorry this is a basic question but what am I doing wrong here? to Windows command line arguments - problems with " and \ May 2, 2016
left1000 commented May 6, 2016

thanks guys, that answers that, sorry for such a silly question! I'll remember this for the future.

ncw commented May 6, 2016

@left1000 I don't think this is a silly question at all - it exposes a bit of windows oddness. I should probably put this either in the docs somewhere!

@ncw ncw referenced this issue May 6, 2016

Windows shell docs #473

ncw commented May 6, 2016

I've made another issue to write some more docs on the windows shell here #473

I'll close this ticket now as I think we've got to the bottom of it.

@ncw ncw closed this May 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment