See CleanPath. Though I don't think it works for Win9x.
Figuring out from that code how to change other environment variables permanently should not be difficult.
Sorry, I never did figure exactly how you are supposed to set environment variables on Win9x. If you are running that, then you'll probably just have to update AutoExec.bat.
- tye
| [reply] [Watch: Dir/Any] |
Not sure quite sure what you mean by permanently, but maybe these will help:
- Really Permanently: Why not go through Settings -> Control Panel -> System -> Advanced -> Environment Variables?
- Win32::Registry The keys you are looking for are:
- HKCU\Environment - User (saved between logons)
- HKLM\System\CurrentControlSet\Control\Session Manager\Environment - System
- HKCU\VolatileEnvironment - User (not saved between logons)
- Meta::Utils::Env: May work for you, check the docs.
Hope these help,
Smitz | [reply] [Watch: Dir/Any] |
Could you clarify what you mean? If you want to change them
for every bootup, you can toss this into your AUTOEXEC.BAT:
PATH=%PATH%;C:\h
If you're just talking about for the current program, you
can modify %ENV. Or are you talking about modifying it for
whoever runs your script? | [reply] [Watch: Dir/Any] [d/l] |
As far as I know, you have to restart the computer for System Environment Variables to take effect. | [reply] [Watch: Dir/Any] |
You only need to (re-) start the processes that you need to see the new System Environment vars, after changes are made through the ControlPanel->System->environmentTab or directly through the registry.
For example. If you have a CMD window open, it won't see changes made whilst it is open, but if you open a new one (via the Start menu short cut!) it will.
However, if you start a new window from an existing one using START, then that new session will inherit its environment from the existing window and so will not see any changes made through the control panel or the registry since the original window was opened. That is, unless you use the /I switch on the START command, in which case it will get a fresh copy complete with changes.
The same is true for any other applications running when the change is made. They will not see those changes as their copy of the environment was created when they were. Whether any child processes they spawn will see changes will depend upon what flags the app uses when is calls CreateProcess.
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
| [reply] [Watch: Dir/Any] |