# Function Reference

# _WinAPI_FindExecutable

Retrieves the name of the executable file associated with the specified file name

#include <WinAPIShellEx.au3>
_WinAPI_FindExecutable ( $sFileName [, $sDirectory = ""] )

## Parameters

$sFileName | Fully qualified path to existing file
$sDirectory | [optional] Default directory

## Return Value

Success: | The Full path to the executable file started when an "open" by association is run on the file specified
Failure: | Empty string if no association was found, @extended contains an error code as $SE_ERR_*

## Remarks

$SE_ERR_* constants require #include <APIShellExConstants.au3>

## See Also

Search FindExecutable in MSDN Library.

## Example

    #include <MsgBoxConstants.au3>
    #include <WinAPIShellEx.au3>

    ; Find the executable that is associated with the AutoIt script.
    MsgBox($MB_SYSTEMMODAL, "Find Executable", "File: " & @ScriptFullPath & @CRLF & "Executable: " & _WinAPI_FindExecutable(@ScriptName))