Re: Environment variables in batch files?



From: "Linn Kubler" <lkubler@xxxxxxxxxxxxxxxxxx>

| Hi,
|
| Why is it that I can set an environment variable in a logon batch file but
| when I type 'Set' in a command window I don't see my environment variable in
| the list?
|
| Thanks in advance,
| Linn
|

Because the variable is created and used in a daughter process and is not passed up to the
parent process. Once the batch file ends (or the Command Prompt closes) the daughter
process ends and the variable no longer exists.

In Win9x/ME Environmental Variables are added to the AUTOEXEC.BAT file and the system will
then need to be rebooted. Then the variables will be available (WinME actually will parse
the AUTOEXEC.BAT file and update the Registry) On NT based OS's you have to; Right click on
"My Computer", choose "Advanced", then "Environmental Variables" and add a "user" or
"global" (system) variable.. Then the variable will be available in all daughter processes.

--
Dave
http://www.claymania.com/removal-trojan-adware.html
http://www.ik-cs.com/got-a-virus.htm


.



Relevant Pages

  • Re: batch file in all users startup dir wont run ? (ok running manually)
    ... click environmental variables towards the bottom. ... to the system variables. ... > - when running the batch file manually by double clicking it works i.e i ... > - when the batch file is added to STARTUP dir it does not run at login ...
    (microsoft.public.windowsxp.general)
  • Re: Environment variables in batch files?
    ... > | Why is it that I can set an environment variable in a logon batch file ... > Because the variable is created and used in a daughter process and is not ... Once the batch file ends ...
    (microsoft.public.windows.server.scripting)
  • Re: Cannot run batch files
    ... and this will display what folders you search. ... not in one of these folders, windows gives up. ... You either have to path to the batch file, or add the folder to your ...
    (microsoft.public.windowsxp.general)

Loading