TobbeSweden
6th October 2006 10:22 UTC
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"
CrushBug
6th October 2006 16:31 UTC
From the documentation:
4.2.3 Constants
$PROGRAMFILES
The program files directory (usually C:\Program Files but detected at runtime).
TobbeSweden
6th October 2006 16:48 UTC
Yes, $PROGRAMFILES probably work with IfFileExists, but %ProgramFiles% doesn't...
kichik
6th October 2006 16:53 UTC
You need to expand the paths using ExpandEnvStrings.
TobbeSweden
6th October 2006 16:57 UTC
Great, thanks!