Categories
Software development

The useful App Paths registry key

Yesterday on the Italian Delphi newsgroup run by Marco Cantù, Delphi&Dintorni, appeared a post asking how to load BPLs without writing them in the system directory or in the application directory.

I suggested to use the “App paths” registry key [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths], but while looking for a reference for its proper use I didn’t find a complete one, even on MSDN. It looks to be poorly documented, yet it’s a very useful key.

First, you have to create a key under the App Paths key named after you application executable. Then you have the following options:

  • If you set the “default” value (which can be created passing an empty string as its name) to your application path and filename, Windows will be able to run it just typing the exe name in the “Run” dialog or “Address” toolbar (if you use it and ever wondered why it worked for some apps but not others, you know why now).
  • You can create a value (string type)  named “Path”, which should contain a comma delimited list of directories where application DLLs can be found.
  • You can map an executable to another (look at the pbrush.exe entry, that maps it to mspaint.exe).

Some Microsoft applications (i.e. Office 2007) uses other values, for example useURL (set to 1), but I have no clue if they are application specific values stored there, or have a broader meaning.