Windows batch files with HTTP options

Hello,

This must have a very simple solution, but I can't seem to find it. When I run the following command interactively in a Windows shell, it works perfectly:

rclone copy --http-url "https://URL" ":http:" "Local path" --checkers 2 --transfers=1 --progress --delete-during --local-no-sparse --multi-thread-streams 0 --low-level-retries 64 --retries 64 --fast-list --max-delete=50 --http-headers "Cookie","logged-in-sig=Long string","Cookie","logged-in-user=user%40domain"

If I run this in a batch file, it won't work because the Windows shell will try to translate the string and the website will give me access denied.

For example, user%40domain will be translated to user0domain (I checked with -vvv). There are a bunch of percentage characters inside the cookie string that will also be incorrectly translated.

How can I prevent this translation to occur when running a batch file under Windows? I tried double quotes, but it didn't work.

Thanks!

I think you escape a % sign by doubling it up to %%. Does that work? The stack overflow answer I looked at indicated that it may or may not need escaping in "double quoted strings".

1 Like

Yes, it works! Looks like escaping characters in Windows batch is a dark art...

Thanks a lot!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.