Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > Executable > tryResolve

Executable.tryResolve() method

Given a filename, this determines the absolute path of the executable file that would be executed by a shell:

  • If the filename is missing a path, then the shell's default PATH will be searched. - If the filename is missing a file extension, then Windows default file extensions will be searched.

Signature:

static tryResolve(filename: string, options?: IExecutableResolveOptions): string | undefined;

Parameters

ParameterTypeDescription
filenamestringThe name of the executable file. This string must not contain any command-line arguments. If the name contains any path delimiters, then the shell's default PATH will not be searched.
optionsIExecutableResolveOptions(Optional) optional other parameters

Returns:

string | undefined

the absolute path of the executable, or undefined if it was not found

Remarks