Re: How do I set an environment variable to a string
- From: Dave Peterson <petersod@xxxxxxxxxxxxxxxx>
- Date: Wed, 13 Aug 2008 09:31:15 -0500
The environment variable would be alive as long as the Shell is alive--but it's
limited to that shell and its children.
So if you need to run a .bat file that needs an environment variable, you could
shell to a different .bat file that sets the environment variable and then runs
the .bat file that you need to run.
But if you want to change the environment variable globally, it's a different
story.
Win95 came with command called WinSet that did this. But I don't see it in
WinXP (at least in a normal install).
But you could search google looking for alternatives.
I've never used this, but it looks interesting:
http://www.codeguru.com/cpp/w-p/win32/tutorials/article.php/c10849/
ChristopherL wrote:
I modified test5 to make the shell command wait till the command
completes, but was rewarded with the same results, nothing printed!
Chris
(5) The following did not work either:
Sub test5()
Dim ev_result As String
ev_result = Shell("cmd /c set chris=""1 2 3""")
ev_result = Environ("chris")
Debug.Print ev_result '--->Prints Nothing!
End Sub
--
Dave Peterson
.
- Follow-Ups:
- Re: How do I set an environment variable to a string
- From: ChristopherL
- Re: How do I set an environment variable to a string
- From: ChristopherL
- Re: How do I set an environment variable to a string
- References:
- How do I set an environment variable to a string
- From: ChristopherL
- RE: How do I set an environment variable to a string
- From: Bob Bridges
- Re: How do I set an environment variable to a string
- From: ChristopherL
- Re: How do I set an environment variable to a string
- From: Bob Bridges
- Re: How do I set an environment variable to a string
- From: ChristopherL
- Re: How do I set an environment variable to a string
- From: ChristopherL
- How do I set an environment variable to a string
- Prev by Date: Something in this is causing a crash
- Next by Date: Re: FUNCTION SYNTAX
- Previous by thread: Re: How do I set an environment variable to a string
- Next by thread: Re: How do I set an environment variable to a string
- Index(es):
Relevant Pages
|