Re: How do I set an environment variable to a string

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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
.



Relevant Pages

  • Re: Running Excel
    ... I've gotten away from the SHELL command and am stuck with what appears to be ... Private Sub Command32_Click ... Dim xlWorkbook As Excel.Workbook ... > When you use Shell, you lose all subsequent control of the shelled program. ...
    (microsoft.public.access.modulesdaovba)
  • Re: perl menubased user interface
    ... actually use a perl package OR a hash for this, In a "perl package" ... sub map_method { ... # and they're all shell commands. ... Do whatever you want to wrap a shell command. ...
    (comp.lang.perl.misc)
  • Bash-4.0 available for FTP
    ... Unlike previous bash distributions, this tar file includes the formatted ... The shell has been changed to be more ... rigorous about parsing commands inside command substitutions, ... Changes have been made to the Readline library being released at ...
    (gnu.announce)
  • Why newbies dont RTFM...
    ... Even though I've used Linux before, I've never had to do any ... BASH BUILTIN COMMANDS ... last command exited within ... unless the shell is not exeâ ...
    (comp.os.linux.misc)
  • Re: VBScripting, need a little help
    ... > them directly at a command prompt as any of the users and get the desired ... > shell, but nothing is connected or updated. ... >>> 2) I would like to time synch with the domain via VB with out calling ... >>> Sub MapDrive ...
    (microsoft.public.windows.server.scripting)