Is there a way to include '%' (percentage) sign in a batch command

vsz's Avatar


21 Apr, 2015 04:39 PM

I'd like to include a space as part of an URL passed to 'curl', the
space needs to be URL encoded as '%20', the question is how
to include a '%' (percentage) sign as-is, in a batch script line:

curl -v -L --proto-redir =https "" -o mingw.7z

'%%20' and '%20' appears to be converted to '0', see:

  1. Support Staff 1 Posted by Feodor Fitsner on 21 Apr, 2015 06:33 PM

    Feodor Fitsner's Avatar

    Do you specify those commands on UI? CMD or PS?

  2. 2 Posted by name-deleted on 21 Apr, 2015 06:36 PM

    name-deleted's Avatar

    It's CMD, from the UI, yes.

  3. Support Staff 3 Posted by Feodor Fitsner on 21 Apr, 2015 06:45 PM

    Feodor Fitsner's Avatar
  4. 4 Posted by name-deleted on 21 Apr, 2015 06:59 PM

    name-deleted's Avatar

    Thank you, that's viable workaround [1], however I'd prefer to keep curl if there is any chance to use it (it's a standard tool with well-known parameters and internals). Besides this specific problem/example, passing a percentage might be needed in other occasions, so the question is still out, how to include this character? Or do you think it's possible to implement support for it?

    In plain .cmd/.bat files, the way to do it is to duplicate it as '%%', which will be translated to '%' before execution [2].

    [1] the workaround I use now is a short URL.

  5. Support Staff 5 Posted by Feodor Fitsner on 21 Apr, 2015 07:39 PM

    Feodor Fitsner's Avatar

    Yeah, but I meant having that parameter with spaces surrounded bu double quotes. 

    - Feodor

  6. 6 Posted by name-deleted on 21 Apr, 2015 08:26 PM

    name-deleted's Avatar

    Surrounding in double quotes does work in the sense that the spaces get properly passed to 'curl', but the curl download fails anyway, because curl requires spaces in the URL to be encoded as '%20'.

  7. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:55 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac