for /f "delims=" %%n IN (new.txt) DO IF NOT EXIST "%current%\%%n" (
set "n=%%n"
setLocal EnableDelayedExpansion
set "n=!n: =%%20!"
curl.exe --globoff -o "%current%\%%n" --url "http://someserver.com/!n!"
endlocal
)
You can not do string replacement in a for
command replaceable parameter/variable, it is necessary to first copy it into a separate variable to operate with it
Also, by default, for command will split/tokenize the readed lines using spaces and tabs as delimiters, that is the reason for your file names being cut on the first space. Placing the "delims="
option in the for
command disables this behaviour.