Results 1 to 8 of 8

Thread: Changing the path wi VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    2

    Changing the path wi VB

    I know how to change the path using the advapi32.dll but I cannot get the path to take. If I open the Control Panel\System\Environment I see the change but it is not applied yet. How can I systematically apply the change.

    Thanks in advance

  2. #2
    jim mcnamara
    Guest
    You mean the environment variable PATH.

    You CANNOT change it from inside a program and have it be permanent. The change has to be made to AUTOEXEC.

    For a minute I thought you were really confused and wanted the chdir function.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    You can open/edit Autoexec.Bat just like you can any other standard ascii text file.

  4. #4
    jim mcnamara
    Guest
    Which is true. But then you have to reboot to make the environ variables 'stick' the way he wants.

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Couldn't you just run the Autoexec.Bat file after changing it to have it reexecute whatever it contains?

  6. #6
    jim mcnamara
    Guest
    No. Because the environ variables will only apply to the process in which the .bat executed. Once the process ends, those variables go away.

    This is the same as what those api calls do (the ones the poster mentioned) - temporarily set environ variables, on a process lvel only.

    You have to re-create the shell (Explorer.exe) with new environ variables to make them 'stick', ie., reboot.

  7. #7
    Member
    Join Date
    Sep 2000
    Posts
    39
    I think you are refering to NT/2000 environment variables which setup slightly diffirent from 95/98/ME. These variables are set in the registry vs. Autoxec.bat. For example system environment varibles are st under the follofing Reg Key:
    HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

    You can add the values to this key and as Jim said: you have to restart the shell, i.e. reboot.

  8. #8

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    2
    I understand Jim and shtirliz. Sorry about not exlpaining the problem better. However, I think there must be a way to change the path and have it stick for two reasons: some programs load and do not require a reboot but modify the path, secondly, you can change the Environment variable manually and then select the "apply" button for the change to be made with out rebooting.

    Thanks to all who replied.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width