Function executeBatchScript

  • Provide a virtual batch script in the form of a string array that represent the lines of the script.

    Parameters

    Returns IExecuteBatchScriptResult

    The stdout of the batch script.

    Remarks

    • It works by writing the sctipt to a temporary file, (synchronously) executing and then deleting the file.
    • Errors, stdout and stderr are returned after execution has terminated.
    • Batch scripts are only compatible with Windows systems.

    Throws

    Will throw an error if no temporary directory could be found or is provided.

    Example

    executeBatchScript(['ping google.com'])
    returns: {
    stdout: [
    'Pinging google.com [142.250.74.78] with 32 bytes of data:',
    'Reply from 142.250.74.78: bytes=32 time=18ms TTL=55',
    'Reply from (...)'
    ],
    stderr: [],
    error: undefined,
    }

    Example

    executeBatchScript(['ping google.comm'])
    returns: {
    stdout: ['Ping request could not find host google.comm. Please check the name and try again.'],
    stderr: [],
    error: 'Error: Command failed (...)',
    }

Generated using TypeDoc