home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
sysutl
/
addpath.arc
/
ADDPATH.DOC
< prev
Wrap
Text File
|
1987-12-06
|
3KB
|
64 lines
Addpath.doc by Rick Sattler - 12-06-87 - Portland, Oregon
addpath.bat has been tested and will correctly run
using DOS 3.0 and on. If you have used the COMMAND.COM
patches in these libraries, you can remove the "echo off"
and/or the "cls" commands from this batch file. They are
only here for neatness.
I created addpath.bat to assist in expanding the DOS PATH
variables while I am working with files on my hard disk.
DOS does not give any easy way to expand this string except
by typing out the whole thing every time I wanted to make
a change or addition.
My first clue to any help in this area was reading the new
DOS 3.2 manuals requarding the previously undocumented
replaceable parameter signs "% %". By placing an environment
variable between the two percent signs, it is possible to
expand on these paramenters and use them in batch files.
Unmentioned here is that they will only work inside batch
files.
Hence, the creation of addpath.bat. The first version
contained no error checking and, if a parameter was not
specified, added a ";" at the end of the PATH string. This
was not satisfactory. After much trail and error, the version
you have now contains simple error checking for times that
a parameter on the command line is not specified.
The correct syntax for addpath is
addpath [d:][path]
where [d:] is the drive designation
and [path] is the full pathname to add to the string.
For example, lets say your current PATH string is:
PATH=c:\dos;c:\;c:\batch;c:\utility;d:\turbo
and you want to add your turboc directory "d:\turboc"
to the string. You could modify the autoexec.bat file and
reboot. But you don't want this designation permanent. You
could also type the whole string including the addition at
the DOS command line. This can be tedious. Addpath.bat
lets you add the string simply and without much effort.
You would simply type:
addpath d:\turboc
Your new PATH string will now look like this:
PATH=c:\dos;c:\;c:\batch;c:\utility;d:\turbo;d:\turboc
Addpath.bat first checks to see if a parameter "%1" has
been entered following the name of the file. If not, the
file "goesto" the "noparm" part of the file that sends
an error message to the screen. If addpath does find a
parameter, it finds the environent string "path" and returns
it to the file. Then the file adds a ";" and the new
path addition to the end of the PATH string and exits.
ENJOY!