[comp.sys.ibm.pc] PATH vs. SET

nortond@well.UUCP (03/03/87)

In article <441@thumper.UUCP>, tr@thumper.UUCP (Tom Reingold) writes:
>
> I suspect that batch files can interpret the percent signs around your
> variables during a SET command but not a PATH command.
> 
> I have read that the PATH command is provided for compatibility with
> DOS 2.x since the SET command does the same and more.  I have also
> read that the PATH command is "better" or "safer" than the SET
> command.  Does anyone know why this would be?

The percent signs work in the PATH and SET commands equally well.

The only difference between the two is that the PATH command will convert
the string to upper case.  The SET command, however, will respect the case
of everything to the right of the "=" sign.  The name to the left of the "="
is always converted to upper case, regardless of its name.

I suppose it would be safer to use PATH rather than SET since it is supported
on older versions of DOS and any batch files which use set in this way would
not be backwards compatible.  Another excuse might be for forward compatibility
where the PATH command could be used to let a shell know that the variable
is changing.  A shell might be interested if it were maintaining a hash index
to speed directory searches.
-- 
--
Daniel A. Norton    ...!lll-lcc!{lll-crg,ptsfa}!well!nortond