Windows command line: How to append a variable in a loop?

Solution 1:

Try changing it to this:

set js_files=
for %%f in (js/*.js) do set js_files=!js_files! js/%%f
echo %js_files%
C:\path\to\jsminifier.exe --inputfiles %js_files%

Note the change of set js_files=%js_files% js/%%f to set js_files=!js_files! js/%%f – by using the exclamation points in place of percent signs, you're instructing the shell to expand the environment variable dynamically during execution.