LKBEN10709: Howto use Application Specific Paths in windows


You are having application problems because the path does not seem to work.




Microsoft has offered a solution to all these problems. An application can now store it own path in the registry under the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

The use the application path, set a key for your application, using testapp.EXE from the example above:

HKEY_LOCAL_MACHINE\...\CurrentVersion\App Paths\testapp.exe

Set the (Default) value to the full path of your executable, for example:

C:\Program Files\testapp\testapp.exe

Add a sub-key named Path, set it's value to the full path of the DLL, for example:

C:\Program Files\Common

With an App Path registry entry, the system will load DLLs in the following order.

   1. The directories listed in the App Path registry key
   2. The directory where the executable module for the current process is located.
   3. The current directory.
   4. The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
   5. The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
   6. The directories listed in the PATH environment variable.


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.