Perhaps
Run should behave like
CreateProcess:
Quote:
The lpApplicationName parameter can be NULL. In that case, the module name must be the first white space–delimited token in the lpCommandLine string. If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin; otherwise, the file name is ambiguous. For example, consider the string "c:\program files\sub dir\program name". This string can be interpreted in a number of ways. The system tries to interpret the possibilities in the following order:
c:\program.exe files\sub dir\program name
c:\program files\sub.exe dir\program name
c:\program files\sub dir\program.exe name
c:\program files\sub dir\program name.exe
Source: MSDN: CreateProcess FunctionI suppose it would just need to test each space-delimited substring as is before appending ".exe".
Comments in the AutoHotkey source code say (about CreateProcess, which is used by Run for executable files):
Code:
// MSDN: "If [lpCurrentDirectory] is NULL, the new process is created with the same
// current drive and directory as the calling process." (i.e. since caller may have
// specified a NULL aWorkingDir). Also, we pass NULL in for the first param so that
// it will behave the following way (hopefully under all OSes): "the first white-space – delimited
// token of the command line specifies the module name. If you are using a long file name that
// contains a space, use quoted strings to indicate where the file name ends and the arguments
// begin (see the explanation for the lpApplicationName parameter). If the file name does not
// contain an extension, .exe is appended. Therefore, if the file name extension is .com,
// this parameter must include the .com extension. If the file name ends in a period (.) with
// no extension, or if the file name contains a path, .exe is not appended. If the file name does
// not contain a directory path, the system searches for the executable file in the following
// sequence...".
I suppose the red text is no longer accurate for "current" versions of Windows.