This is a slightly different question from Populating Array in DOS Batch Script
I'm trying to compile a JavaScript application using Google Closure Compiler. The list of JavaScript files has grown to 30+ files, and I'm looking for a way to manage it. What I've settled on is to push the files to an array using something like the following:
set projectDrive=E:
set js_folder=\project\trunk\htdocs\script
set deploy_folder=\project\trunk\htdocs\bin
set closure_compiler=java -jar Z:\utils\compiler.jar
set arrayline[0]=\script\com\appstudio\utils\Shim.js
set arrayline[1]=\script\com\jquery\chosen.jquery.min.js
set arrayline[2]=\script\com\jquery\jquery-cookie.js
set arrayline[3]=\script\com\jquery\jquery.qtip.js
set arrayline[4]=\script\com\jquery\jquery.zclip.min.js
set arrayline[5]=\script\com\swfobject\swfobject.js
::etc
set arrayline[31]=\script\com\lastfolder\lastFile.js
According to the post mentioned above, I know I can loop through the array like this:
for /l %%n in (0,1,12) do (
echo !arrayline[%%n]!
)
However, this doesn't give me the output I need, as each echo is on a new line. I need a concatenated string for Closure Compiler that will result in something like this:
%closureCompiler% --js "%deployFolder%\arrayline[0].js" --js "%deployFolder%\arrayline[1].js" --js_output_file "%deployFolder%\script.js"
Where I can execute Closure Compiler against a concatenated list of array elements in the format of --js "%deployFolder%\arrayline[x].js" Is this possible?
EDIT: I didn't mention originally that I'm using an array because this is a quick and dirty proof of concept for a continuous integration environment. I'm going to be spitting these files out in different ways in different contexts, but the Closure Compiler output is the first step in that process. I'm stuck with a Windows box for now and my IDE doesn't do what I want it to, so I'm working with batch files, just the choice I made for this stage of the project.