Where is "START" searching for executables?
Command start finds executables to run like command line interpreter cmd.exe does if no absolute path is used, using additionally the extensions listed in environment variable PATHEXT separated by semicolons if file extension is also missing.
-
Current working directory.
-
All directories of environment variable PATH in order as listed in PATH.
Just type in a command prompt window
set path
to see all directories in PATH as well as all file extensions in PATHEXT.Please note that each user account has its own PATH. Therefore PATH of system account is usually different to PATH of a standard user account. That is very important on running a batch file with command runas or via task scheduler using a different account.
The batch file posted by Jason Faulkner is very helpful here, too.
-
start looks further in registry under the keys
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths
HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\App PathsApplications installed with an MSI package (embedded in installer EXE or published separately) using msiexec have their file name registered under App Paths with default string value containing name of executable with full path. There is often a second string value with name Path containing just the full path to the executable of the application. Other installers register an application also in
App Paths
, see Microsoft documentation page Application Registration.
The App Paths key in registry hive HKEY_CURRENT_USER
usually does not exist as installation is done using trusted installer or local administrator account and therefore the registration of the installed application is done in registry hive HKEY_LOCAL_MACHINE
. But on a per user installation of an application the HKCU
path is used for application registration instead of HKLM
path.
The App Paths key under Wow6432Node key exists only on Windows x64. But x86 applications are registered nevertheless usually in both App Paths although Wow6432Node is for 32-bit applications and the other tree for 64-bit applications on Windows 7 x64, Windows Server 2008 R2 x64 and later Windows x64. For details see Microsoft article Registry Keys Affected by WOW64.
One more note:
Even with .exe
specified, start searches in current working directory as well as in directories of PATH after not found AppName.exe
additionally for AppName.exe.*
and checks file extension (string after last period) against the file extensions in PATHEXT if this returns one or more file names. It is nevertheless always better to specify the file extension of the application to start as a search for AppName.exe
is always done first before the wildcard search is executed if AppName.exe
could not be found in the current directory.
The free tool Process Monitor of Sysinternals (Microsoft) is a great tool to find out things like that.
Last but not least for none executables start checks also HKEY_CLASSES_ROOT for a file association to open a file or a URI (URL) with associated application defined for command open. That is the reason why something like below also works.
start MyTextFile.txt
start https://stackoverflow.com/
%SystemRoot%\System32\cmd.exe
containing the code for start
uses the Windows shell function ShellExecuteEx for executing applications or opening files or URLs with associated application.