Some Sandboxie settings may include variables. These are placeholder names which are expanded to (replaced by) text which may be specific to a particular computer and user account. For example,
In this simple example, Sandboxie expands the variable Personal by the actual folder for the My Documents folder.
RecoverFolder=C:\Documents and Settings\joe\My Documents\Song_Lyrics
The following table lists the variables that Sandboxie recognizes.
|Variable Name||Expands To|
|sandbox||Name of sandbox in which the program is running.
|User account in which the program is running.
|sid||SID-string identifying the user account in which the program is running.
|session||The number of the logon session in which the program is running.
|ProgramFiles||Location of program files folder.
Example: C:\Program Files (Windows XP)
Example: C:\Programs (Windows Vista)
|SystemRoot||Location of the Windows installation folder.
|SystemDrive||First two characters of %SystemRoot%.
|DefaultSpoolDirectory||Location of the print spool folder.
|UserProfile||Location of the user account root folder.
Example: C:\Documents and Settings\joe (Windows XP)
Example: C:\Users\joe (Windows Vista)
|AllUsersProfile||Location of the shared user account root folder.
Example: C:\Documents and Settings\All Users (Windows XP)
Example: C:\ProgramData (Windows Vista)
|Partial locations of the user account root folder, as defined in the registry key:
|Location of the Windows temporary files folder as defined in the registry key:
|Locations of user-account and system folders as are known to Windows Explorer. For more information, see [Shell Folders](ShellFolders.html).|
Global templates are part of the installation of Sandboxie and reside in the file Templates.ini in the Sandboxie installation folder. Additional local templates may be added to Sandboxie Ini. Any template may reference template variables in the form %Tmpl.SomeVariableName%. These variable names are not built into the core of Sandboxie. They must be defined in Templates.ini or Sandboxie.ini in a [TemplateSettings] section.
Any of the variables in the table above, including any of the Shell Folders variable and any template variables, can be overridden by the Sandboxie Ini configuration file. To override a variable, add a setting with an Ovr. prefix.
[GlobalSettings] Ovr.SystemRoot=X:\WIN Ovr.Tmpl.Firefox=C:\Firefox\Profiles\
[DefaultBox] Ovr.Personal=Z:\MY_FILES [RecoverFolder](RecoverFolder.html)=%Personal% [OpenFilePath](OpenFilePath.html)=%SystemRoot%\Temp
When a variable is overriden in this way, its expanded value will always match the value specified in the configuration file.
Some of the variables in the table above are taken from the system registry. Those variables are ProgramFiles and any other variable that appears below ProgramFiles in the table above. For these variables, it is possible to specify "fallback" values in the Sandboxie Ini configuration file. To specify a fallback for a variable, add a setting with a Reg. prefix.
Note that "Ovr."-style overrides (described above) will cause Sandboxie to not look in the registry at all. On the other hand, Sandboxie only considers "Reg."-style fallbacks if the expanded variable cannot be found in the registry. This means that if both Ovr.X and Reg.X are specified for the same variable X, the Ovr.X form will always apply when X is expanded, and the Reg.X form will never apply.
It is generally preferable to use "Ovr."-style overrides than "Reg."-style fallbacks.