home *** CD-ROM | disk | FTP | other *** search
- echo off
- echo.
- echo ┌───────────────────────────────────────────────────┐
- echo │ Add new directories to the path │
- echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, 21-Oct-90 │
- echo └───────────────────────────────────────────────────┘
- echo.
-
- if "%1"=="" goto _help
-
- rem Set the new path, loop and shift to allow adding more than one directory
- :_loop
- if "%1"=="" goto _out
- rem Check that the directory exists
- if not exist %1\nul if not exist %1nul goto _err1
- set tmp_=%path%
- rem Check that not already at path, first make uppercase
- path=%1
- set upcase_=%path%
- path=%tmp_%
- set double_=false
- for %%f in (%path%) do if "%upcase_%"=="%%f" set double_=true
- for %%f in (%path%) do if "%upcase_%"=="%%f\" set double_=true
- for %%f in (%path%) do if "%upcase_%\"=="%%f" set double_=true
- if "%double_%"=="true" goto _err2
- rem Add the directory to the path
- path=%tmp_%;%1
- shift
- goto _loop
-
- :_help
- echo Usage: ADDPATH [FirstNewDirectory] [SecondNewDirectory] [...]
- echo.
- echo Examples: ADDPATH c:\bat
- echo ADDPATH c:\telec\kermi e:\arczip
- echo.
- echo The original path can be saved and restored by applying
- echo pushpath.bat and poppath.bat. This is useful if you want your
- echo addition to be temporary only.
- echo.
- echo If you get an "Out of environment space" message, increase your
- echo environment space by using shell configuration in config.sys:
- echo MsDos 3.30 example: shell=c:\bin\command.com /e:1024 /p
- echo.
- echo Current path %path%
- goto _out2
-
- :_err1
- echo Directory %1 does not exist, not added
- goto _out
-
- :_err2
- echo Directory %1 already at path, not added
- goto _out
-
- :_out
- path
- :_out2
- set tmp_=
- set double_=
- set upcase_=
- echo on
-