Archive: IfFileExists %ProgramFiles%


IfFileExists %ProgramFiles%
I'm reading a path to a file from the registry. It's a posibility that the path will contain %ProgramFiles% or %SystemRoot% or other variables like those.

Is there any way to make paths like those work with IfFileExists?

Here's an example of a path like that:
"%Program Files%\Outlook Express\msimn.exe"


From the documentation:


4.2.3 Constants
$PROGRAMFILES
The program files directory (usually C:\Program Files but detected at runtime).

Yes, $PROGRAMFILES probably work with IfFileExists, but %ProgramFiles% doesn't...


You need to expand the paths using ExpandEnvStrings.


Great, thanks!