Blog

Interactive Shell vs Native OS

Brad Wood February 23, 2015

Spread the word

Brad Wood

February 23, 2015

Spread the word


Share your thoughts

There are two ways to run commands via CommandBox: inside the CommandBox interactive shell, or one-at-a-time commands from your native shell.

Multiple Commands

If you open the interactive shell, you will see the CommandBox splash screen (ASCII art) and then you'll be presented with the CommandBox> prompt. You can enter as many commands as you wish in order and after each command is finished executing, you will be returned to the CommandBox prompt. If you have multiple commands you want to execute manually, this is the fastest method since CommandBox only loads once. This is also the only way to make use of features like tab complete and command history.

This example show running the box.exe executable from a Windows DOS prompt, executing the version, pwd, and echo commands, and then exiting back to DOS.  

C:\>box

   _____                                          _ ____            
  / ____|                                        | |  _ \           
 | |     ___  _ __ ___  _ __ ___   __ _ _ __   __| | |_) | _____  __
 | |    / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` |  _ < / _ \ \/ /
 | |___| (_) | | | | | | | | | | | (_| | | | | (_| | |_) | (_) >  < 
  \_____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|____/ \___/_/\_\  v1.0.0.00093

Welcome to CommandBox!
Type "help" for help, or "help [command]" to be more specific.
CommandBox> version
CommandBox 1.0.0.00093
CommandBox> pwd
C:\
CommandBox> echo "Hello World!"
Hello World!
CommandBox> exit

C:\>

 

One-Off Commands

You can also spin up CommandBox from your native shell to execute a single command inline. You can do this if you only have one command to run, or you want to automate a command from a Unix shell script or Windows batch file. This mode will not show the ASCII splash screen, but keep in mind it still loads CommandBox up and unloads it in the background. Any output from the command will be left on your screen, and you will be returned to your native OS prompt.

Here is an example of running the version command from a Windows DOS screen. Note, you'll need to either do this from the directory that holds the box executable, or add the executable to your default command path so it is found.

C:\>box version
CommandBox 1.0.0.00093
C:\> box pwd
C:\
C:\> box echo "Hello World!"
Hello World!
C:\>

The box text is calling the CommandBox binary, and the version bit is passed along to the CommandBox shell to execute once it loads.  You'll notice this example calls the same commands as the previous, but all from the operating system's native shell.

 

Add Your Comment

(2)

Feb 23, 2015 13:45:43 UTC

by Sean Coyne

Is there a way to script multiple commands for use in other shell scripts? For example, lets say I write a batch or shell script that does a number of things, and only a couple of them involve CommandBox. Rather than run them as `box command arg arg` each time which will spin up CommandBox each time can I put the box commands in a file and have CommandBox run the commands inside the file? Maybe a file like box-commands.txt and then in my batch/shell script do something like `cat box-commands.txt >> box` or maybe `box -command-file box-commands.txt`?

Just a thought. I've been doing a lot of DevOps stuff lately with Vagrant and provisioning and having CommandBox be a part of that might be helpful but its painfully slow to run `box command` multiple times within a single script.

Feb 23, 2015 13:55:38 UTC

by Brad Wood

Yes Sean, we have several things already in place to help you with this. If you just want to run a series of CFML statements in a row, you can run an entire .cfm file with box binary. You can also create shell scripts on Unix operating systems that you just execute natively from the shell. Please see Luis's blog post from Friday that covers these approaches. <a href=http://www.ortussolutions.com/blog/running-cfml-from-the-command-line">http://www.ortussolutions.com/blog/running-cfml-from-the-command-line</a> And if you just want to run multiple CommandBox commands at once, then you want to look into our recipe command. You point it at myRecipe.boxr and it will run each line as a command. Luis also blogged about this on the 13th: <a href=http://www.ortussolutions.com/blog/lets-get-cooking-with-commandbox-recipes">http://www.ortussolutions.com/blog/lets-get-cooking-with-commandbox-recipes</a> And finally, this is all documented in our new GitBook-based docs so please give them a read: <a href=http://commandbox.ortusbooks.com/content/">http://commandbox.ortusbooks.com/content/</a>

Recent Entries

TestBox 7 : Real-Time Streaming, a Browser IDE, and a Major Leap for BoxLang

TestBox 7 : Real-Time Streaming, a Browser IDE, and a Major Leap for BoxLang

TestBox 7.x series continues our mission to be the best testing framework for BoxLang and CFML. This release is focused heavily on BoxLang CLI runner enhancements, real-time streaming test execution via SSE, a powerful dry run capability, the brand-new TestBox RUN web IDE, and significant quality-of-life improvements for developers working in both BoxLang and CFML environments.

Luis Majano
Luis Majano
March 17, 2026
From Legacy Risk to Modern Agility: A Phased Modernization Roadmap for CFML Teams

From Legacy Risk to Modern Agility: A Phased Modernization Roadmap for CFML Teams

Many organizations running CFML applications today face the same challenge.

Their systems still work.

They support core business processes.

They generate revenue.

But at the same time, those platforms are increasingly exposed to risk.

Unsupported runtimes, operational fragility, security exposure, and difficulty integrating with modern systems are becoming more common in environments still running older versions of Adobe ColdFusion or Lucee.

The quest...

Cristobal Escobar
Cristobal Escobar
March 16, 2026
Introducing the BoxLang Spring Boot Starter: Dynamic JVM Templating for Spring

Introducing the BoxLang Spring Boot Starter: Dynamic JVM Templating for Spring

Spring Boot developers know the pain of evaluating view technologies. Thymeleaf is great — until you need more expressiveness. FreeMarker is powerful — until the syntax fights you. What if you could write templates in a dynamic JVM language that gives you the full power of the platform, feels natural, and requires zero setup to integrate?

Meet the BoxLang Spring Boot Starter.

Luis Majano
Luis Majano
March 13, 2026