interface IShell {
    Child: typeof Child;
    Command: typeof Command;
    executeAppleScript: (script: string) => Promise<ChildProcess<string>>;
    executeBashScript: (script: string) => Promise<ChildProcess<string>>;
    executeNodeScript: (script: string) => Promise<ChildProcess<string>>;
    executePowershellScript: (script: string) => Promise<ChildProcess<string>>;
    executePythonScript: (script: string) => Promise<ChildProcess<string>>;
    executeZshScript: (script: string) => Promise<ChildProcess<string>>;
    hasCommand: (command: string) => Promise<boolean>;
    likelyOnWindows: () => Promise<boolean>;
    makeAppleScript: (script: string) => Command<string>;
    makeBashScript: (script: string) => Command<string>;
    makeNodeScript: (script: string) => Command<string>;
    makePowershellScript: (script: string) => Command<string>;
    makePythonScript: (script: string) => Command<string>;
    makeZshScript: (script: string) => Command<string>;
    open: (path: string, openWith?: string) => Promise<void>;
}

Properties

Child: typeof Child
Command: typeof Command
executeAppleScript: (script: string) => Promise<ChildProcess<string>>
executeBashScript: (script: string) => Promise<ChildProcess<string>>
executeNodeScript: (script: string) => Promise<ChildProcess<string>>
executePowershellScript: (script: string) => Promise<ChildProcess<string>>
executePythonScript: (script: string) => Promise<ChildProcess<string>>
executeZshScript: (script: string) => Promise<ChildProcess<string>>
hasCommand: (command: string) => Promise<boolean>

Type declaration

    • (command: string): Promise<boolean>
    • Determine if a command is available with which or where command. Support Windows, Mac, Linux

      Parameters

      • command: string

      Returns Promise<boolean>

likelyOnWindows: () => Promise<boolean>

Type declaration

    • (): Promise<boolean>
    • Run powershell.exe -Command 'echo $env:OS' to determine if the current platform is likely to be Windows. Not 100% accurate. If a Mac or Linux somehow has powershell.exe in PATH, this will return true.

      Returns Promise<boolean>

      Whether the current platform is likely to be Windows.

makeAppleScript: (script: string) => Command<string>
makeBashScript: (script: string) => Command<string>
makeNodeScript: (script: string) => Command<string>
makePowershellScript: (script: string) => Command<string>
makePythonScript: (script: string) => Command<string>
makeZshScript: (script: string) => Command<string>
open: (path: string, openWith?: string) => Promise<void>

Type declaration

    • (path: string, openWith?: string): Promise<void>
    • Opens a path or URL with the system's default app, or the one specified with openWith.

      The openWith value must be one of firefox, google chrome, chromium safari, open, start, xdg-open, gio, gnome-open, kde-open or wslview.

      Parameters

      • path: string

        The path or URL to open. This value is matched against the string regex defined on tauri.conf.json > plugins > shell > open, which defaults to ^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+.

      • OptionalopenWith: string

        The app to open the file or URL with. Defaults to the system default application for the specified path type.

      Returns Promise<void>

      import { open } from '@tauri-apps/plugin-shell';
      // opens the given URL on the default browser:
      await open('https://github.com/tauri-apps/tauri');
      // opens the given URL using `firefox`:
      await open('https://github.com/tauri-apps/tauri', 'firefox');
      // opens a file using the default program:
      await open('/path/to/file');

      2.0.0