Does {sys} work?

Source: C:\windows\system32\msvcr100.dll; DestDir: {app}\util

Open in new window

works ok, but shouldn't I be able equally to write
Source: {sys}\msvcr100.dll; DestDir: {app}\util

Open in new window

? Doesn't work -- gives an error "J:\setup\{sys}\msvcr100.dll" not found. (J:\setup happens to be the logged directory from which Inno is running)

Similarly, I can't get away with
#IfExist "{sys}\msvcr100.dll"

Open in new window

(using Inno Preprocessor). The test simply fails although C:\windows\system32\mscvr100.dll does exist.

Why? What am I doing wrong?
Who is Participating?
mirtheilConnect With a Mentor Commented:
{sys} is a runtime constant. It is not a compile time constant.  
ForensMathAuthor Commented:
Ah. You mean it doesn't designate a location on my development computer, but on that of the installation target machine.

That's logical in that it's a vital facility to have, whereas I was just looking for a minor convenience. But is there a way to access compile time constants from Inno Setup or Preprocessor? I just ask for a further comment if you have one; you have solved the original problem.
ForensMathAuthor Commented:
The answer puzzled me for a few minutes, but as a mathematician I can't whine about brevity.
You can create your own defines using the Preprocessor (#define) at compile time.  If you have an environment variable you want to access you can use GetEnv to set the value.  For example, I use something like:

#define MyTemp GetEnv("temp")

This is just an example, but should give you a starting point.
ForensMathAuthor Commented:
Good to know. Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.