Function RunWait

  • Runs a program and waits for it to close before continuing.

    Parameters

    • program: string

      The name of the program to run.

    • directory: string = ''

      Optional working directory for the program.

    • showFlag: number = ShowWindowFlag.SHOWNORMAL

      Optional flag to control how the program's window is shown.

    Returns number

    The exit code of the program.

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

    const exitCode = RunWait('notepad.exe');

    console.log(exitCode); // Output: 0