I want to pass %DownParameters% and %URL% to function :myWGET in below code stored in a batch file with name abc.bat.
set DownParameters="--continue --wait=5 --no-check-certificate --retry-connrefused --tries=30 -blah -blah" set URL=https://someip/a.zip call :myWGET %DownParameters% %URL% :myWGET wget.exe %1 %2 REM what i expected is wget.exe %DownParameters% %URL% goto:eof However, this is not working because of the spaces in %DownParameters%.
The workaround is using %DownParameters% directly in :myWGET, but that is not wanted.
How to pass the arguments in %DownParameters% and %URL% to function :myWGET for usage on wget.exe command line?
[update 1]
by using set "DownParameters=--no-check-certificate --wait=30 --tries=1 --retry-connrefused --header="Connection: close""
--header="Connection: close" will still cause trouble when
Call :myWGET "%DownParameters%" "%URL%"
echo %~1 in :myWGET show
--no-check-certificate --wait=30 --tries=1 --retry-connrefused --header="Connection: , the "` close" is missing, what need to be escaped?
Goto :Eof. After having called the label:myWgetprogram flow reaches the wget command again this time using eventually present command line arguments - not call arguments.