|
-
Jun 10th, 2008, 09:47 AM
#1
Thread Starter
Junior Member
Environment Variables??
I am going crazy!
Does anyone know how to create a permanent environment variable via run-time or a batch file?
Thanks
-
Jun 10th, 2008, 09:53 AM
#2
Re: Environment Variables??
Take a look at the Environment.SetEnvironmentVariable method.
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Jun 10th, 2008, 11:11 AM
#3
Thread Starter
Junior Member
Re: Environment Variables??
Environment.SetEnvironmentVariable looks like it might work.
What about with a batch file?
-
Jun 10th, 2008, 11:55 AM
#4
Re: Environment Variables??
 Originally Posted by w8taminute
What about with a batch file?
What about it? That a batch file thing, not a vb thing.
Last edited by JuggaloBrotha; Jun 10th, 2008 at 08:38 PM.
-
Jun 10th, 2008, 12:37 PM
#5
Re: Environment Variables??
Via a batch file:
Code:
SETX MyVarName "Hello World!"
Via .Net code:
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
Environment.SetEnvironmentVariable ("MyNewVar", _
"Hello World!", EnvironmentVariableTarget.User)
End Sub
End Class
I've just tried and tested both and they insert user environment variables fine.
Last edited by alex_read; Jun 10th, 2008 at 12:41 PM.
-
Jun 10th, 2008, 01:49 PM
#6
Thread Starter
Junior Member
Re: Environment Variables??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|