Batch File to Run Sandbox Programs (with Objects)

If it doesn't fit elsewhere, it goes here
Post Reply
SBIE User
Posts: 96
Joined: Fri Nov 10, 2006 10:58 am

Batch File to Run Sandbox Programs (with Objects)

Post by SBIE User » Fri Nov 10, 2006 12:08 pm

The following batchfile, which I call BoxRun.bat, will allow you to run programs in a sandbox and indicate an optional object for the program. (For example, you could run Notepad with the object myfile.txt or Firefox with the object of http://www.sandboxie.com . You can also use this program to run programs in the sandbox without objects by just pressing ENTER when asked for the object.)

Code: Select all

@echo off
:: Boxrun.bat starts a user-specified program under SandboxIE control
:: and allows adding an optional object (example: notepad.exe myfile.txt).
::
:: CHANGE SANDBOXIE PROGRAM LOCATION AFTER = IN THE NEXT LINE, IF NECESSARY.
SET boxrun="C:\Program Files\Sandboxie\Start.exe"
:: DO NOT MAKE CHANGES BELOW THIS LINE.
MODE CON cols=80 lines=11
COLOR 17
CLS
echo.
echo  ENTER drive:\dir\file.ext (NO QUOTES) for the Sandboxed program
::    Note: If the program is on the Windows path, just enter its shortname.
echo.
:: THERE SHOULD BE ONE BLANK SPACE AFTER THE ? IN THE NEXT LINE.
set /p program= ? 
echo.
set object=zzzzzzz
echo  ENTER any object (NO QUOTES) for the program or press ENTER for none
echo    (Example: Notepad might take an object of f:\temp\myfile.txt .)
echo.
:: THERE SHOULD BE ONE BLANK SPACE AFTER THE ? IN THE NEXT LINE.
set /p object= ? 
if not %object%==zzzzzzz goto PLUSOBJ
%boxrun% "%program%" &exit
:PLUSOBJ
%boxrun% "%program%" "%object%" &exit
If you know a little about batch coding, you can simplify this file and change the text used for the prompts, but I included comments to make it easier to use out of the box for those who are not experienced with batch file programming.

Hope someone finds this little utility helpful.

(By the way, before someone else says it, you can accomplish the same thing as this batch file by right-clicking on the Sandboxie Control icon in the tray and choosing Run Sandboxed/Any Program and then filling in the fully-qualified path/program plus any object. This just provides an alternative if you find it useful.)
SBIE (Happy) User

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest