沙盘程序可以使用dos命令和相关参数完成下列功能。

Start启动:在沙盘中运行程序
Stop 停止:关闭沙盘程序
List列表:显示在闪盘中运行的程序列表
Delete 删除:删除沙盘中的内容
Reload重载:重新载入沙盘配置
Disable Forced Programs禁用强制程序

程序启动
沙盘程序可以根据一个可执行程序的绝对路径和相对路径,在沙盘中运行此程序:

"C:\Program Files\Sandboxie\Start.exe" c:\windows\system32\calc.exe
"C:\Program Files\Sandboxie\Start.exe" calc.exe

两个特例:
在沙盘中运行网页浏览器

"C:\Program Files\Sandboxie\Start.exe" default_browser

在沙盘中运行电子邮件客户端

"C:\Program Files\Sandboxie\Start.exe" mail_agent

“运行任意程序”的窗口:

"C:\Program Files\Sandboxie\Start.exe" run_dialog

从开始菜单运行:

"C:\Program Files\Sandboxie\Start.exe" start_menu

在Start.exe和参数之间插入/box:SandboxName,表示沙盘程序具体的名称(默认:DefaultBox)

"C:\Program Files\Sandboxie\Start.exe" /box:TestBox run_dialog

特例

/box:__ask__

使用后需要手动选择沙盘。

参数

/nosbiectrl

用于确保在沙盘中运行程序之前不运行Sandboxie Control(主程序窗口):

"C:\Program Files\Sandboxie\Start.exe" /nosbiectrl calc.exe

参数

/silent

用于不显示错误消息:

"C:\Program Files\Sandboxie\Start.exe" /silent no_such_program.exe

参数

/elevate

用于使用Administrator权限运行程序:

"C:\Program Files\Sandboxie\Start.exe" /elevate cmd.exe

参数

/wait

用于等待程序运行完成,返回状态信息:

"C:\Program Files\Sandboxie\Start.exe" /wait cmd.exe

请注意,Start.exe是一个Win32应用程序,而不是一个控制台应用程序,因此系统的“开始”命令是很有用的,这里强制系统等待Start.exe完成:

start /wait "C:\Program Files\Sandboxie\Start.exe" /wait cmd /c exit 9

echo %ERRORLEVEL%
9
The system waits for Start.exe to finish, which in turn waits for “cmd /c exit 9″ to finish, and then the exit status 9 is returned all the way back.

参数顺序任意,例如:

"C:\Program Files\Sandboxie\Start.exe" /box:CustomBox /silent /nosbiectrl MyProgram.exe

程序停止
停止运行一个沙盘中的所有程序:

"C:\Program Files\Sandboxie\Start.exe" /terminate
"C:\Program Files\Sandboxie\Start.exe" /box:TestBox /terminate

如果省略/box:,将终止默认沙盘DefaultBox。

程序列表
显示在一个特定的沙盘中的所有正在运行的程序列表的系统进程ID号

"C:\Program Files\Sandboxie\Start.exe"  /listpids
"C:\Program Files\Sandboxie\Start.exe"  /box:TestBox  /listpids

如果省略/box:SandboxName 参数,将列出默认的DefaultBox。

显示的输出格式是每行一个进程ID,例如:

"C:\Program Files\Sandboxie\Start.exe"  /listpids | more

3
3036
2136
384
注意,Start.exe不是一个控制台应用程序,所以输出不会出现在命令提示符窗口,除非你试用输出结构,如 | more。

删除沙盘中的内容

"C:\Program Files\Sandboxie\Start.exe"  delete_sandbox
"C:\Program Files\Sandboxie\Start.exe"  delete_sandbox_silent

参数 /box:SandboxName 要位于Start.exe和删除命令中间。
_silent的删除命令的后缀,表示沙盘忽略任何错误,不显示任何错误消息。

删除操作分为两个阶段:
Phase 1 scans the contents of the sandbox and processes files which could pose a problem during the second phase:
Junctions (also known as reparse points) are removed.
Read-only files and directories are made fully Accessible.
Files and directories that have very long names are renamed to shorter names.
Renames the sandbox to the format __Delete_(sandbox name)_(some random number)_. For example, if the sandbox is DefaultBox, it could be renamed to __Delete_DefaultBox_01C4012345678912.
Phase 2 deletes any sandboxes that were processed in phase 1.
Sandboxes that were processed in phase 1 are those that have been renamed as described above.
More than one sandbox may be deleted in phase 2.
By default, the standard system command RMDIR is used to delete the renamed sandbox folder.
Alternatively, a third-party delete utility may used.

不同阶段的命令:

"C:\Program Files\Sandboxie\Start.exe"  delete_sandbox_phase1
"C:\Program Files\Sandboxie\Start.exe"  delete_sandbox_phase2
"C:\Program Files\Sandboxie\Start.exe"  delete_sandbox_silent_phase1
"C:\Program Files\Sandboxie\Start.exe"  delete_sandbox_silent_phase2

重载配置
此命令功能是重新载入沙盘配置,通常用于手动编辑Sandboxie.ini文件后。

"C:\Program Files\Sandboxie\Start.exe"  /reload

在程序正在运行时使用重载命令不会改变当前效果。

禁用强制程序
下列命令的功能是在沙盘外运行此程序:

"C:\Program Files\Sandboxie\Start.exe"  /dfp            c:\path\to\program.exe
"C:\Program Files\Sandboxie\Start.exe"  /disable_force  c:\path\to\program.exe

/dfp 和 /disable_force 是相同的。

此命令的另一个功能是用来禁用强制运行的程序(右击系统托盘中沙盘,选择禁用强制运行程序)。

"C:\Program Files\Sandboxie\Start.exe"  disable_force

请注意disable_force前没有斜杠,此命令没有对应的取消命令。

官方原文:http://www.sandboxie.com/index.php?StartCommandLine

转自:http://zephyrxt.com/bbs/thread-8740-1-1.html

Related Posts: 沙盘Sandboxie命令行(Windows)中文详解 :