Two folders in the Path environment variable that each contain EXE with same name, which one will run

environment-variableswindows 7

Let's say I have two folders listed in my Path environment variable like so:

"C:\FolderA; C:\FolderB"

And within each of those folders, I have a program named "testprog.exe". When I open a command window and type "testprog.exe". Which one will be run? What if testprog.exe in FolderB is a later version of the testprog.exe in FolderA? Does the system care? Is it indeterminate which one will run? What happens?

Thanks,

-Robert

Best Answer

The one in FolderA will be run.

The path is evaluated in the order it is listed, with the current folder preceding it.

Windows doesn't care about the version of the application.

See http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/path.mspx?mfr=true (though this is for XP).

Related Topic