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
I ask for help.
Code: Select all
/box: Name of the new Sandbox Program.exe
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.
echo.
pause
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.
Users browsing this forum: No registered users and 1 guest