Results 1 to 3 of 3

Thread: API call to append to system PATH

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Princeton, New Jersey
    Posts
    46

    API call to append to system PATH

    Hello,

    Anyone know the API function to get and append to the system Path environment variable? (Windows NT/2000)

    There was a post here previously that stated:

    I know how to change the path using the advapi32.dll but I cannot get the path to take
    ... but I can't find the function that does this.

    I do not need to make the change permanent, only for the duration of the process.

    Thanks, Dale.

  2. #2
    Megatron
    Guest
    To get the system directory use the GetSystemDirectory function. You can then append to it using normal VB functions.

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    VB Code:
    1. Private Declare Function SetEnvironmentVariable Lib "kernel32.dll" Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Long
    2.  
    3. Private Sub Command1_Click()
    4.     Dim strPath As String
    5.     Dim lngRet As Long
    6.    
    7.     strPath = Environ("PATH")
    8.     Call SetEnvironmentVariable("PATH", strPath & "C:\YourOtherPath;")
    9. End Sub

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