Is there a way to include '%' (percentage) sign in a batch command
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 "https://www.mirrorservice.org/sites/dl.sourceforge.net/pub/sourceforge/m/mi/mingw-w64/Toolchains%%20targetting%%20Win64/Personal%%20Builds/mingw-builds/4.9.2/threads-win32/sjlj/x86_64-4.9.2-release-win32-sjlj-rt_v4-rev2.7z" -o mingw.7z
'%%20' and '%20' appears to be converted to '0', see:
https://ci.appveyor.com/project/vsz/harbour-core-evxk0/build/3.4.184
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | 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

Support Staff 1 Posted by Feodor Fitsner on 21 Apr, 2015 06:33 PM
Do you specify those commands on UI? CMD or PS?
2 Posted by name-deleted on 21 Apr, 2015 06:36 PM
It's CMD, from the UI, yes.
Support Staff 3 Posted by Feodor Fitsner on 21 Apr, 2015 06:45 PM
Why wouldn't you just use spaces like here: https://ci.appveyor.com/project/FeodorFitsner/simple-console/build/...
4 Posted by name-deleted on 21 Apr, 2015 06:59 PM
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 bit.ly short URL.
[2] http://www.robvanderwoude.com/escapechars.php
Support Staff 5 Posted by Feodor Fitsner on 21 Apr, 2015 07:39 PM
Yeah, but I meant having that parameter with spaces surrounded bu double quotes.
- Feodor
6 Posted by name-deleted on 21 Apr, 2015 08:26 PM
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'.
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:55 AM.