• Runs an external program.

    Parameters

    • program: string

      The path to the program to run.

    • workingDir: string = ''

      Optional working directory for the program.

    • showFlag: number = ShowWindowFlag.SHOWNORMAL

      Optional flag to control how the program window is shown. See ShowWindowFlag for details.

    Returns number

    The PID of the process if successful, or 0 if failed.

    import { Run } from '@ahmic/autoit-js';

    const pid = Run('notepad.exe');

    console.log(pid); // Output: 1234