Introduction
This is a part 2 of a previous post - ScoopBox. If you haven’t read it yet go check it out. It goes into details about Windows Sandbox and its configuration system. Also, there is a very detailed explanation how you can make a script without using any third party tools.
What is Boxer
Boxer is a cli tool that launches Windows Sandbox with preinstalled applications or execute scripts at startup. It takes full advantage of the ScoopBox library implementing and exposing all the functionalities to the end user.
Download
Boxer is still in a preview version which makes it very flexible. If you have any suggestions which you want to see in Boxer just open an issue.
dotnet tool install --global boxer --version 0.1.0-preview1
Once you execute the command type:
boxer version
To confirm that the installation went smoothly.
How to Use
Let’s start with something simple. Say you want to start the Windows Sandbox with already installed Visual Studio Code, Git and Fiddler. All you must do is type:
boxer script --chocolatey "vscode,git,fiddler"
This command uses Chocolatey package manager to find and locate the packages and install them at startup.
What about if your package is not available in Chocolatey? Fortunately, Chocolatey is not the only supported package manager in Boxer. You can choose between Chocolatey and Scoop. Here is how you can install same applications using Scoop:
boxer script --scoop "vscode,git,fiddler"
What else you can do with Boxer?
Let’s say that you want to prepare the machine before first use. You can execute your own scripts:
boxer script -f "C:/Script1.ps1; C:/Script2.ps1"
All scripts will be run in order.
What else?
You can also combine both commands:
boxer script -f "C:/PrepareSandbox.ps1" --chocolatey "git,vscode" -f "C:/CloneRepository.ps1;C:/PrepareDevEnvironment.ps1"
Do you need to type all this every time?
Boxer also supports a simple configuration file. Here is an example of how you can execute the above script as a configuration file:
[
{
"args":["C:\\PrepareSandbox.ps1"],
"type":"File"
},
{
"args":["git", "vscode"],
"type":"Chocolatey"
},
{
"args":["C:\\CloneRepository.ps1", "C:\\PrepareDevEnvironment.ps1"],
"type":"File"
}
]
Once you have a configuration file saved as config.json you can use it to start Windows Sandbox:
boxer config "PATH_TO\\config.json"
For full documentation about the config file see the Github repo.
Conclusion
Boxer offers a very simple way to start Windows Sandbox with preinstalled applications. You can also use it to execute startup scripts inside Sandbox. Lastly Boxer supports a configuration file which you can create and execute easily without writing your programs every time.
If you have any suggestions about improving Boxer leave a comment or open an issue in Github. I will be happy to discuss it.
Thank you
Your post has been submitted and will be published after moderation.
OK
OOPS!
Your post has not been submitted. Please return to the page and try again. Thank You!
If this error persists, please open an issue by clicking here.
OK