Link to home
Start Free TrialLog in
Avatar of fantamen
fantamenFlag for Italy

asked on

Add an environment variable in vb net

I need to call an external application and before calling some environment variable have to be set. I use the windows api SetEnvironmentVariable but it doesn't work. Is there another method to do this operation?
' This is the declaration.
Declare Function SetEnvironmentVariable Lib "kernel32" Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Integer
'  This is the instruction.
SetEnvResult = SetEnvironmentVariable("Mfextmap", lc_mfextmap)

Open in new window

Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

I found that there was no easy to use .net class to set an environment variable ...

http://blog.jtbworld.com/2005/11/set-environment-variable-using-vbnet.html
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fantamen

ASKER

Ok