Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Windows, what is the preference of how Windows looks through these folders to find .dlls? For example, if I have two versions of the same dll, one in the System 32 folder and one on the System Path, where does Windows look first?

share|improve this question

Windows first searches for "known DLLs", such as Kernel32.dll and User32.dll.

Windows then searches for the DLLs in the following sequence:

The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.

The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.

The directory where the executable module for the current process is located.

The current directory.

The directories listed in the PATH environment variable.

Note that under 64 bit windows 32 bit processes use the 32 bit system32 directory- not the 64 bit one.

It's slightly different pre sp1 of 2k3 or XP.

share|improve this answer

Depends on your PATH environment variable, but usually %windir%\System32 is added before %windir%.

Wearing my developer hat: wherever possible I'd avoid installing anything to either of these folders, especially for recent OS versions with side-by-side assembly support (e.g. XP/Vista/2008).

If you've installed an application that's put a .DLL in both places then I'd contact the developer to fix it.

share|improve this answer
And @chickeninabiscuit is right too :-) – devstuff Jul 10 '09 at 0:40

Have a bang on this:

Note the "Order has changed!" comment that references this page:

share|improve this answer

DLL loading is handled by the Windows API LoadLibrary function and the search order is described in the documentation for that:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.