find_command
Locates an executable command within a provided or system-defined path, optionally accounting for platform-specific file extensions. It searches the filesystem for the command and returns the full path to the first match found, or None if no match exists.
def find_command(
cmd: string,
path: list = null,
pathext: list = null
) - > string
Locates the full executable path for a given command by searching through specified directories and checking for platform-specific file extensions.
Parameters
| Name | Type | Description |
|---|---|---|
| cmd | string | The name or filename of the command to locate. |
| path | list = null | A list of directory paths to search; defaults to the system PATH environment variable if not provided. |
| pathext | list = null | A list of executable file extensions to append during the search, such as .EXE or .BAT; defaults to the PATHEXT environment variable. |
Returns
| Type | Description |
|---|---|
string | The absolute path to the executable if found, otherwise None. |