Skip to content

fb.shell System Integration

showInExplorer(path)

Reveals a file in Windows File Explorer.

javascript
await fb.shell.showInExplorer('E:\\\\Music\\\\song.flac');

openWith(path)

Opens a file with its system-associated application.

Security restriction

Executable file types such as .exe, .bat, and .cmd are rejected.

javascript
await fb.shell.openWith('E:\\\\Music\\\\cover.jpg');

openExternal(url)

Opens a URL in the default browser.

javascript
await fb.shell.openExternal('https://www.foobar2000.org');

exec(command, options?)

Executes a system command and returns a ShellExecResponse containing success and, on success, processId.

Security boundary

Commands are not allowlisted because installed themes are treated as trusted code, with a trust boundary comparable to installing a foobar2000 component. When provided, cwd is validated and paths outside the permitted boundary, including protected system directories, are rejected. Prefer fb.file.* for destructive file operations so PathSecurity restrictions apply.

ParameterTypeDescription
commandstringCommand to execute
options.argsstring[]Command-line arguments
options.cwdstringWorking directory
options.hiddenbooleanHide the child window. Defaults to true
javascript
await fb.shell.exec('notepad', { args: ['E:\\\\notes.txt'] });

spawn(executable, options?)

Starts a process through the structured spawn API, recommended for services such as Node applications.

Security boundary

Executables are not allowlisted; trust the theme author. Absolute executable paths and cwd values are validated, and paths outside the permitted boundary, including protected system directories, are rejected. An empty-string cwd is rejected by the SDK before invoking the host.

ParameterTypeDescription
executablestringExecutable name or absolute path
options.argsstring[]Process arguments
options.cwdstringWorking directory
options.hiddenbooleanHide the child window. Defaults to true
options.waitForExitMsnumberWait up to this many milliseconds for exit. Defaults to 0 (do not wait)

The response contains processId on success. If waitForExitMs is positive, it may also contain exited and, when the process exited in time, exitCode.

javascript
const result = await fb.shell.spawn('E:\\\\FB2K\\\\Runtime\\\\node.exe', {
  args: ['E:\\\\FB2K\\\\NeteaseApi\\\\server.js'],
  cwd: 'E:\\\\FB2K\\\\NeteaseApi',
  hidden: true,
  waitForExitMs: 900
});