[comp.sys.ibm.pc] Need help with setting PATH...

shan@ihlpl.ATT.COM (Califf) (01/12/88)

Is there a maximum length for defining your PATH in a autoexec.bat file?
I have an extremely long PATH and have noticed DOS seems to truncate it!
I have tried increasing my environment size, but to no avail.

Does anyone know of a way to increase the lenght of your PATH?

Shannon Califf        ihnp4!ihlpl!shan

Thanks in advance...

prem@amdcad.AMD.COM (Prem Sobel) (01/15/88)

To increase your path lenth, or more accurately your environment size,
you need DOS 3.2 or latter and must put the following line as the first
in CONFIG.SYS

	shell=c:\command.com /e:1024 /p

of course you could use a size larger than 1024.

-- prem

mario@wjvax.UUCP (Mario Dona) (01/16/88)

In article <3645@ihlpl.ATT.COM> shan@ihlpl.ATT.COM (Califf) writes:
>
>Is there a maximum length for defining your PATH in a autoexec.bat file?
>I have an extremely long PATH and have noticed DOS seems to truncate it!
>I have tried increasing my environment size, but to no avail.
>
I don't have an answer to your question, but I'd like to share an experience
(read "problem") I had with long paths.  I recently installed a large
data base program (Microrim System V) and, as I cusomerily do, included the 
new directory in the AUTOEXEC.BAT path.  The program ran great from it's
own directory, but when I tried to run it from any other directory it 
wouldn't load properly.  I called Microrim's cusomer support line and
they pointed out that the name of the directory should be located nearer 
to the beginning of the path string.  Sure enough, that solved the
problem.  I don't have an answer to why this happens, but maybe some
guru out there can tell us.

ray@micomvax.UUCP (Ray Dunn) (01/22/88)

In article <3645@ihlpl.ATT.COM> shan@ihlpl.ATT.COM (Califf) writes:
>Is there a maximum length for defining your PATH in a autoexec.bat file?
>I have an extremely long PATH and have noticed DOS seems to truncate it!
>I have tried increasing my environment size, but to no avail.
>
>Does anyone know of a way to increase the lenght of your PATH?

As has been pointed out in other replies, the maximum size of any variable
is 128 bytes including the terminator, and that a "good" way of reducing
the length of your PATH definition is to use the SUBST command to define
long paths as "drives".

Can I suggest that a better way of reducing the length of your PATH
definition is to reduce the length of your PATH!!

Obviously the further the system or applications have to search down a path, 
the less efficient things get (a good test - how long does it take to report
"Bad command or file name" when you type a non-existent command).

A method I use: Have a top-level directory, say CMNDS, near the head of the
path, which contains a set of BAT files each to call an application which
you have in separate directories.  The BAT file can contain change or
push/pop directory commands as required, before and/or after calling the
application.  These application directories can now be removed from the PATH
definition.

On my systems, I usually copy this CMNDS directory to a RAM disk at
AUTOEXEC time, and the PATH is defined to look for it there.

One further point: when an executable is called from a BAT file, it is much
more efficient to include the full path of that executable in the call
rather than relying on the PATH variable to ensure it is found.  This is
*required* if the BAT file and the EXE file have the same names, and the BAT
file does not change to the EXE file's directory.

E.g. Depending on the circumstances, FRED.BAT could contain the single line

C:\PATH\TO\FRED.EXE

or the lines:

PUSH C:\PATH\TO
FRED.EXE
POP

Various versions of the PUSH and POP directory commands have done the rounds
of the nets, or CD can be used with the usual problem of being left in the
wrong directory.

[Flame Retardant: I know that executing BAT files is pretty inefficient,
 however the above has been determined as "a good way" for me, with my
 requirements, and when a RAM disk is used.  I am using a fairly complex
 directory structure with MANY applications directories in 2 20Meg
 partitions on a 386 based machine.
 It does not work for all applications, especially those which themselves
 require directories on the PATH.  However under these circumstances it is
 often possible to have a PATH redefinition in the BAT file.]

Incidently (non-relevant nonsense, but it is Friday afternoon (here)(now)):
This posting is being created using XTALK in a window of WINDOWS 386 running
on top of MSDOS, to talk to EMACS, which has been invoked by RN, running
under UNIX on a VAX!  In another window I'm using FinalWord 2 (my favourite
PC editor) to edit a C source file, while another is compiling in a third
window.  I currently do NOT have any other jobs executing on the VAX, woops,
sorry, there's still a print job running.  This may explain my mental state!
When wanting to see just exactly what the current PATH was when writing the
above, I of course executed a shell in an Emacs window rather than one in
Windows, so of course couldn't understand what /usr/local/bin was doing
there!  Enough of this dribble!

Ray Dunn.  ..philabs!micomvax!ray