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
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.)