• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 455
  • Last Modified:

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

0
fantamen
Asked:
fantamen
  • 2
1 Solution
 
DhaestCommented:
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
0
 
DhaestCommented:
Set System Information and Environment Variables With VB.Net

http://www.freevbcode.com/ShowCode.asp?ID=8293
0
 
fantamenAuthor Commented:
Ok
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now