◄Example► ◄Contents► ◄Index► ◄Back► ────────────────────────────────────────────────────────────────────────────── ' This example uses the ENVIRON$ function to get a copy of your current ' PATH variable. Your PATH is then changed using the ENVIRON statement. ' The program then uses the ENVIRON$ function to print out the contents ' of the environment string table. The example concludes by restoring ' your original PATH statement. ' Note: For this example to run, the value of your path variable must be ' longer than the new path value in the ENVIRON statement. ' To try this example: ' 1. Choose New Project from the File menu ' 2. Copy the code example below to the code window ' 3. Press F5 to run the example CLS ' Clear the screen DEFINT A-Z PATH$ = "PATH=" ' Initialize I% = 1 OldPath$ = ENVIRON$("PATH") ' Get the old PATH ENVIRON "PATH=C:\BIN;C:\DOS;C:\BUSINESS" PRINT "Your current environment settings are:" ' Display the string table PRINT DO WHILE ENVIRON$(I%) <> "" PRINT ENVIRON$(I%) I% = I% + 1 LOOP ENVIRON PATH$ + OldPath$ ' Change the PATH back PRINT PRINT "Your PATH has been restored to:" ' Verify the change PRINT PRINT ENVIRON$("PATH")