home *** CD-ROM | disk | FTP | other *** search
- ECHO OFF
- REM Add directory names to current path
- REM Written in 1990 by Otto Makela, Jyvaskyla, Finland
-
- REM Included in my (Timo Salmi's) batch file collection with Otto's
- REM explicit permission. Thanks Otto. This batch nicely demonstrates
- REM testing a condition (is a directory already in the path) in MsDos
- REM batch programming. I had an interesting time testing Otto's batch
- REM and discussing the dilemmas in the earlier versions after Otto
- REM posted the original version in alt.msdos.programmer. I think that
- REM we both gained in the process.
-
- REM From: otto@jyu.fi (Otto J. Makela)
- REM Subject: Addpath.Bat, again
- REM To: ts@uwasa.fi
- REM Date: Sat, 13 Jan 90 3:35:17 EET DST
-
- REM Take care whole path is uppercase
- PATH %PATH%
- :LOOP
- REM Finish if no parameters, or ran out of parameters
- IF /%1/==// GOTO EXIT
- REM Remember old path, convert new addition to uppercase
- SET _ADD=%PATH%
- PATH %1
- REM Handle special cases of no path set and path same as current parameter
- IF /%_ADD%/==/%PATH%/ GOTO SKIP
- IF /%_ADD%/==// GOTO SKIP
- REM Then figure out if already in current path setting
- FOR %%D IN (%_ADD%) DO IF %%D==%PATH% SET PATH=
- REM If was not, add it
- IF NOT /%PATH%/==// PATH %PATH%;%_ADD%
- IF /%PATH%/==// PATH %_ADD%
- :SKIP
- SHIFT
- GOTO LOOP
- :EXIT
- SET _ADD=
- PATH
- ECHO.
- ECHO ON
-
- REM * * * Otto J. Makela (otto@jyu.fi, MAKELA_OTTO_@FINJYU.BITNET) * * * * * * *
- REM * Phone: +358 41 613 847, BBS: +358 41 211 562 (CCITT, Bell 2400/1200/300) *
- REM * Mail: Kauppakatu 1 B 18, SF-40100 Jyvaskyla, Finland, EUROPE *
- REM * * * freopen("/dev/null","r",stdflame); * * * * * * * * * * * * * * * * * *
-