Allow CommandBox commands to be executed in "batch"


Pick a file extension to use that is basically a text file where each line is interpreted as a CommandBox command.
In the future, we can even try to register this file type to be executed by CommandBox automatically if double clicked.

Create a command (or overload the execute command) that will read this file, loop over each time, and call runCommand() on each of them.

This will allow someone to fully script the creation of a site, etc by putting all the commands in a single file and then running them at once.

Also, allow additional arguments passed to the command to be referenced as $1, $2, etc or by name as $argName. This would allow one batch file to be reusable with external variables such as install dir or applicationName passed in at run time.

ex batch file createSite.boxr:

And that could be called like so:

Here's the same file but using named args createSite.boxr:

And that could be called like so:

Ignore empty lines and also allow for lines starting with a # to be considered comments and ignored.


Denny Valliant
June 21, 2014, 10:26 PM

I like the dollar sign better too!

The conversation on the other ticket made me take a closer look at the URI stuff, and I see that when I added "execute" to tell it to execute a script I broke the "#!/usr/bin/env railo" *nix scripts.

I fixed this by checking if the first argument is a file that exists, and doesn't end in a "cfshell" extension (.boxr in the above example). If it is one of our batch files it's passed to the shell to execute, otherwise it's executed directly as before.

So when we bump the Railo CLI version, on *nix you'll be able to do:

content of ./runme.boxr :
#!/usr/bin/env commandbox
forgebox install coldbox-platform
forgebox install testbox

chmod +x runme.boxr

to run it.

I haven't bumped the CommandBox dependency yet, because there's an outstanding issue of eating the hashbang line (#!/usr/...) I need to fix, and I wanted to run the logic by you y'all. These changes will let us associate file extensions with the CommandBox scripts for Windows, OS X, and *nix (cfdistro can automatically add them to the native binaries, FWIW).

Brad Wood
June 21, 2014, 11:11 PM

That's perfect actually. I absolutely love the idea of the boxr files being "executable" so you just tell them to run and the OS just knows to use CommandBox to do that.

Brad Wood
June 26, 2014, 11:26 PM

Updated estimate of remaining hours

Luis Majano
July 9, 2014, 6:19 PM

Brad, you can go ahead and finalize this.

Luis Majano
July 30, 2014, 12:57 AM

Add the echo information to the documentation



Brad Wood


Brad Wood



Affects versions


Fix versions

Time tracking


Time remaining

1h 28m