Creating a sandbox through a command

If it's not about a problem in the program
Post Reply
Posts: 1
Joined: Mon Mar 13, 2017 12:16 pm

Creating a sandbox through a command

Post by _KROSCH » Mon Mar 13, 2017 12:22 pm

Hello. I apologize, I use Google translator.

How can I create a new sandbox through a command?
If you do this:

Code: Select all

/box: Name of the new Sandbox Program.exe
That gives an error about the fact that the sandbox does not exist.

I ask for help.

Sandboxie Support
Sandboxie Support
Posts: 2228
Joined: Mon Nov 07, 2016 3:10 pm

Re: Creating a sandbox through a command

Post by Barb@Invincea » Tue Mar 14, 2017 12:11 pm

Hello _KROSCH,

What are you trying to do exactly?

Here are the current options for the Start command:


Posts: 5121
Joined: Sun Apr 27, 2008 5:24 pm
Location: Ohio, USA

Re: Creating a sandbox through a command

Post by Guest10 » Tue Mar 14, 2017 4:19 pm

The program SbieIni.exe, in Sandboxie Control's Program files folder, is used to create sandboxes or to modify/remove settings in existing sandboxes, using the command line.
Frankly, it is awkward to use and I do not recommend using it.

When I was experimenting with using SbieIni.exe I used Windows XP, and I put my test '.cmd' files in Sandboxie's Program Files folder.
Now that I'm using Win 10, I think that permissions would be a problem if attempting that, so I would use the complete path to the SbieIni.exe program in my .cmd file.

There's a bug in the SbieIni.exe program that was never fixed, and affects a Sandboxie Control menu:
After using the program you will see extra lines in the "Sandbox" menu in Sandboxie Control, that can be corrected by exiting/restarting Control.
Horizontal lines will be created just above the "Create New Sandbox" menu item.

Code: Select all

@echo off

rem Note that the next line uses the Windows 'set' command to
rem  create an environmental variable - so that the lines below will
rem  be shorter.

set program="C:\Program Files\Sandboxie\SbieIni.exe"

rem Note that the following lines use the 'set' command in SbieIni.exe.
rem I think that these 2 Sandbox Settings are required for all sandboxes.
rem You could pass the name of the Sandbox to create by using a command line parameter,
rem instead of naming it here, as I have done by using the name "Test5" in these lines.

rem This will create the Test5 sandbox and add these settings:
%program% set Test5 ConfigLevel 7
%program% set Test5 Enabled y

rem No other settings are automatically added as sandbox settings.
rem You must add them all yourself, by adding additional lines such as...

%program% set Test5 AutoDelete y
%program% set Test5 BorderColor #00FFFF
%program% set Test5 BoxNameTitle y
%program% set Test5 AutoRecover n
%program% set Test5 ClosedFilePath InternetAccessDevices
%program% set Test5 DropAdminRights y

rem The new sandbox will be useable, but it won't show in Sandboxie
rem  Control's window until you do a Configure > Reload Configuration.

rem 'set' is a bit dangerous to use if you use SbieIni.exe to modify
rem an exiting sandox's settings. The 'append' command is also
rem available as described in the list of SbieIni.exe commands.

echo Use Control's Configure ^> Reload Configuration to see
echo the Test5 sandbox in Control's window.
SbieIni.exe Usage:

Code: Select all

SbieIni.exe <query|queryex|set|append|insert|delete> <section> <setting> <value>

SbieIni query[ex] [/expand] [/boxes] <section> [setting]
- specify * for section to get a list of sections in the configuration
- specify /boxes to get a list of sections which correspond to sandboxes
   that are enabled and active for this user account
- specify * for [setting] to get a list of settings in a specific section
- specify [setting] to get the value of a setting in a section
- specify /expand to expand variables in the value of the setting
- queryex command is same as query /expand

SbieIni set <section> <setting> <value>
- replaces all existing settings with the new value. If value is omitted, all existing
  lines that match the type <setting> will be removed entirely

SbieIni append <section> <setting> <value>
- adds a new setting and value line, after any existing setting lines of that type

SbieIni insert <section> <setting> <value>
- adds a new setting and value line, ahead of any existing setting lines of that type

SbieIni delete <section> <setting> <value>
- removes a setting and value line which exactly matches the specified setting and value

<section>: lines enclosed in brackets [...]
<setting>: items like Template; OpenFilePath; AutoRecover; RecoverFolder
<value>  : items that are on the right side of the = sign in the configuration file,
           following a <setting>
*** NOTES ***
If the commands in these examples are run from a .cmd file, then every occurrence of %...%
 in a <value> needs to use %%....%%.
That is, <values> like %Personal% must be enclosed in double-quotes: %%Personal%%
This is noted where variables are used in <values>, in the examples below.

If <value> contains a {space} character, the entire <value> needs to be enclosed inside of
 double quotes ("...{space}..."). See the last example under "Delete examples", below.

There does not appear to be any way to use SbieIni.exe to delete a <section> (a line in the
 file that is enclosed in brackets [...])

"Query" examples:

These examples do not show the complete path to sbieini.exe, so it is assumed that they will
 be run from a .cmd file that is saved in Sandboxie's Program Files folder.

sbieini query *
- lists headings of all sections in sandboxie.ini: [GlobalSettings]; [DefaultBox]; etc

sbieini query * | sort > Sections-sorted.txt
- sorts section headings and saves the results to a disk file: 'Sections-sorted.txt'

sbieini query /boxes *
- lists headings (names) of all Enabled sandboxes ("Enabled=y", in the sandbox's settings)

sbieini query /boxes * | sort > Boxes.txt
for /f %%a in (Boxes.txt) do (echo %%a)
- sorts and displays names of Enabled sandboxes; results are saved to disk in 'Boxes.txt';
  and the second line echoes the sandbox names in the command window.

sbieini query DefaultBox *
- lists all of the different types of settings that are used in DefaultBox (the left side
  of the = sign in the configuration file)
(If there are multiple settings of one type, the type is listed only once)
Ex: "Template" will be listed only once, even if it's used multiple times in DefaultBox settings)

sbieini query DefaultBox recoverfolder
- lists all of the "RecoverFolder=" settings in DefaultBox (items to the right of the = sign)

sbieini query /expand DefaultBox recoverfolder
sbieini queryex DefaultBox recoverfolder
- lists (and expands any variables used in <values>) for "RecoverFolder=" targets in DefaultBox

sbieini query DefaultBox template
- lists all "Template=" settings in DefaultBox (items to the right of the = sign)

sbieini query DefaultBox configlevel
- lists the value of "ConfigLevel=" in DefaultBox

sbieini query GlobalSettings template
- lists all "Templates=" settings in [GlobalSettings] (items to the right of the = sign)

To get a value from [UserSettings_xxxxxxx], you must first get the exact section name using:
sbieini query *
 and then use that (name) in a line like:
sbieini query (name) sbiectrl_hidemessage
- lists all of the "SbieCtrl_HideMessage=" settings (the right side of the = sign)
Ex: sbieini query usersettings_12345678 sbiectrl_hidemessage

NOTE: For all of the following operations the Sandboxie.ini file must not be locked.
      For example, the file must not be open in Notepad at the time the command is sent.
"Set" examples:
You must be very careful when using "set".
This parameter can cause the command to delete all occurrences of a setting, in the section
 it applies to.
If you want to add or delete a particular setting, see "append"; "insert"; or "delete", below.

sbieini set DefaultBox RecoverFolder %%Desktop%%
(Double quotes are used around the %Desktop% variable, as shown. Read the NOTE ***, above)
- adds "RecoverFolder=%Desktop%" to the settings for DefaultBox
- DELETES all other RecoverFolder settings in DefaultBox, except for %Desktop%

sbieini set DefaultBox AutoRecover n
- sets "AutoRecover=n" in DefaultBox. Overwrites any existing "AutoRecover=" setting

sbieini set DefaultBox Template AdobeAcrobat
- adds "Template=AdobeAcrobat" to DefaultBox and DELETES all other "Template=" settings

sbieini set DefaultBox Template
- DELETES all "Template=" lines from DefaultBox since no new value was given on the command line

sbieini set GlobalSettings TemplateReject
- DELETES all "TemplateReject=" lines from [GlobalSettings] since no new value was given on
 the command line

"Append" examples:

sbieini append DefaultBox WriteFilePath %%Personal%%
(Double quotes are used around the %Personal% variable)
- appends "WriteFilePath=%Personal% after any existing "WriteFilePath=" settings for DefaultBox

sbieini append DefaultBox Template RoboForm
- appends "Template=RoboForm" to DefaultBox, after any other "Template=" settings

"Insert" examples:

sbieini insert GlobalSettings Template AdobeAcrobat
- inserts "Template=AdobeAcrobat" in front of any other "Template=" lines in [GlobalSettings]

sbieini insert DefaultBox RecoverFolder C:\Downloads
- inserts "RecoverFolder=C:\Downloads" in front of any other "RecoverFolder=" settings in DefaultBox

"Delete" examples:

sbieini delete DefaultBox recoverfolder %%Favorites%%
(Double quotes are needed around the %Favorites% variable)
- deletes "RecoverFolder=%Favorites%" from the settings for DefaultBox

sbieini delete GlobalSettings template roboform
- deletes "Template=RoboForm" from [GlobalSettings]

sbieini delete GlobalSettings OpenIpcPath "\RPC Control\KSControlEp.Default*"
In the previous line, the {space} inside of (\RPC{space}Control) requires that the entire <value>
 be enclosed inside of double quotes ("..."), as shown on the command line in this example.
Other commands, like 'append' and 'set' will require the same thing, if <value> contains a {space}.
end of document.
I can't provide any additional help with using SbieIni.exe
Win 10 Home 64-bit (w/admin rights) - Zone Alarm Pro Firewall, MalwareBytes Premium A/V, Cyberfox, Thunderbird
Sandboxie user since March 2007

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests