How does the start batch command execute a software by calling only its name? [duplicate]
Solution 1:
Yes, this information is stored in the registry.
The key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
has subkeys for every application that you can run directly without being in the path.
The subkey firefox.exe
has two values:
(Default) C:\Program Files\Mozilla Firefox\firefox.exe
Path C:\Program Files\Mozilla Firefox\
The first value specifies the full path of the executable, the second the directory it should run in.
Application Registration (Windows) explains in details where Windows would search for the firefox executable:
When the ShellExecuteEx function is called with the name of an executable file in its lpFile parameter, there are several places where the function looks for the file. We recommend registering your application in the App Paths registry subkey. Doing so avoids the need for applications to modify the system PATH environment variable.
The file is sought in the following locations:
- The current working directory.
- The Windows directory only (no subdirectories are searched).
- The Windows\System32 directory.
- Directories listed in the PATH environment variable.
- Recommended:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths