Execute
Launch an app, open a file, folder, or URL through the OS shell.
javascript
import { execute } from "system";Availability
Available in the Main script only.
Table of Contents
Methods
execute(target [, parameters, workingDir, show]) #
system
Executes a target through the Windows shell — equivalent to double-clicking a file or typing a URL in the Run dialog. Uses ShellExecute internally to launch files, applications, or URLs.
Common show values:
| Value | Constant | Behavior |
|---|---|---|
0 | SW_HIDE | Launch hidden (no window) |
1 | SW_SHOWNORMAL | Normal window (default) |
2 | SW_SHOWMINIMIZED | Start minimized |
3 | SW_SHOWMAXIMIZED | Start maximized |
Parameters
All parameters except target are optional. When not provided:
parametersdefaults to empty stringworkingDirdefaults to empty string (uses system default)showdefaults to1(SW_SHOWNORMAL)
PARAMETERS
target string
Executable path, document path, folder path, or URL to open.
parameters string OPTIONAL
Command-line arguments passed to the launched executable.
workingDir string OPTIONAL
Working directory for the launched process.
show number OPTIONAL
Window show mode (Win32 SW_* constant). Defaults to 1 (SW_SHOWNORMAL).
RETURNS:
boolean true if the OS shell accepted the request, false otherwise.javascript
import { execute } from "system";
// Open a file with its default app
execute("C:\\docs\\readme.txt");
// Launch an exe with arguments
execute("notepad.exe", "C:\\docs\\readme.txt");
// Open a URL in the default browser
execute("https://novadesk.pages.dev/");
// Run a command hidden
execute("cmd.exe", "/c echo hello > C:\\temp\\out.txt", "C:\\temp", 0);