A customer was having trouble with their RGS file.

I want to include the below line in a .rgs file:

val HandlerPath = s '%windir%\system32\awesome.dll'.

When I do this, registering of the dll fails with 80002009. Any help? If I change it to

val HandlerPath = s 'C:\windows\system32\awesome.dll'.

then the registration succeeds (but of course now contains a hard-coded path).

A common problem people have when asking a question is assuming that the person reading your question has knowledge that is a strict superset of what you know. As a result, people omit details like the answer to the question "How did you register your RGS file?"

If all else fails read the documentation (which happens to be the #1 hit for "rgs file", or at least was at the time of this writing). And the documentation explains how the % works. And it's not for environment variable expansion.

Just because you stick something between percent signs doesn't mean that the magical percent sign fairies are going to swoop in and perform environment variable expansion. Wishful thinking does not cause features to spring into existence.

As the documentation says, you need to use the _ATL_REGMAP_ENTRY macro to create the mapping for replacement variables.

This type of question reflects a certain mentality which is cute when kids do it, but frustrating when demonstrated by programmers, namely, that features exist merely because you expect them to, rather than because there's any documentation that suggests that they exist.