This is continuation on question How do I escape ampersands in batch files?.
That question presents some ways to use ampersands in batch files. However, it would seem none of those work for function parameters. Example:
@echo off
setlocal EnableDelayedExpansion
call:myFunction "http://www.google.com/search?client=opera&q=escape+ampersand"
goto:eof
:myFunction
echo Param is: %~1
goto:eof
I would always get
Param is: http://www.google.com/search?client=opera
'q' is not recognized as an internal or external command,
operable program or batch file.
I've tried ^
to escape it and that doesn't seem to work either. Is there a way?
If it matters, my actual use case is supplying a download URL to wget which is called within a batch function.