Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have to work with an ini file, but I need a value set in the file to be based on an environment variable. For example,

... [program] dir=%SystemDrive%\SomeFolder\ ...

In this case, SystemDrive is an environment variable on the machine. The software that reads this ini file is out of my control, but I can see from the error message I get that it read dir as %SystemDrive%\SomeFolder\, instead of the expanded version C:\SomeFolder\.

How do I (or is it possible to) get environment variables to expand when the ini file is read? I don't have access to the code of the program that reads the ini file. However, I'm hoping there is a proper syntax/technique for specifying an environment variable to be expanded.

share|improve this question
    
Probably the only way to achieve this would be for you to write a program that replaced any such variables it found in the .ini file with their current values just before invoking the program that reads it. –  martineau Jul 24 '12 at 18:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.