Hi,
I'm trying to set an environment variable programmaticall y. I've added
these three lines to my code:
System.Environm ent.SetEnvironm entVariable("TC S", "C:\Program Files\TCS\")
InstallPath = System.Environm ent.GetEnvironm entVariable("TC S")
MsgBox(InstallP ath)
And, as expected, the MsgBox contains "C:\Program Files\TCS\".
However the variable seems to exist only for that instance of the app. For
example, if I open a cmd window while the app is running and type "echo %
TCS%", it just returns "%TCS%". If I exit the app, remark out the first
line, and then re-run the app, the MsgBox returns an empty box.
I'm guessing that any environment variables you set using
System.Environm ent.SetEnvironm entVariable are volatile; that is, they don't
exist outside that currently running application.
How can I set it programmaticall y, and have it STAY there?
Regards,
Scott
I'm trying to set an environment variable programmaticall y. I've added
these three lines to my code:
System.Environm ent.SetEnvironm entVariable("TC S", "C:\Program Files\TCS\")
InstallPath = System.Environm ent.GetEnvironm entVariable("TC S")
MsgBox(InstallP ath)
And, as expected, the MsgBox contains "C:\Program Files\TCS\".
However the variable seems to exist only for that instance of the app. For
example, if I open a cmd window while the app is running and type "echo %
TCS%", it just returns "%TCS%". If I exit the app, remark out the first
line, and then re-run the app, the MsgBox returns an empty box.
I'm guessing that any environment variables you set using
System.Environm ent.SetEnvironm entVariable are volatile; that is, they don't
exist outside that currently running application.
How can I set it programmaticall y, and have it STAY there?
Regards,
Scott
Comment