Archive: Check if file exists by regular expression


Check if file exists by regular expression
I'm attempting to create an installer that checks if the user has Microsoft .Net 4.0 installed, and if he/she doesn't install it for them. The code I have so far to check if .Net is installed is as follows:

!define NETVersion "4.0"
IfFileExists "$WINDIR\Microsoft.NET\Framework\v${NETVersion}" NETFrameworkInstalled 0

The problem is that the version is almost never exactly 4.0, on my computer it's 4.0.30319 so the installer thinks I don't have .Net installed. In addition there's also .Net 4.5 out as well which may complicate things. Is there some way to use regular expressions (or some other technique) to check if a user has a file v${NETVersion}(\.\d+)?? or something similar?

Thanks in advance.


You should instead check the "Install" DWORD value is 1 under either of the following keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
(Make sure you SetRegView 64 first if the OS is 64-bit).

Stu


Thanks Stu,

That looks like it might work, however when I look in my registry I find v4 and v4.0. What's the difference between these 2 entries?


If you look at the default value under v4.0, it contains "deprecated".

Stu