This is a slightly different question from Populating Array in DOS Batch Script
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=\script\com\appstudio\utils\Shim.js set arrayline=\script\com\jquery\chosen.jquery.min.js set arrayline=\script\com\jquery\jquery-cookie.js set arrayline=\script\com\jquery\jquery.qtip.js set arrayline=\script\com\jquery\jquery.zclip.min.js set arrayline=\script\com\swfobject\swfobject.js ::etc set arrayline=\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.js" --js "%deployFolder%\arrayline.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.