[comp.sys.ibm.pc] DOS 3.30 PATH and Environment lengths

gjp@sei.cmu.edu (George Pandelios) (07/26/89)

Greetings Netlanders!

I'm having trouble setting my PATH to a length larger than an small 
(127?) number of characters.  According to the DOS 3.3 manual, that 
is suppossed to automatically expand.  Is this really a hard limit?
A mistake on my part?  I've changed the SHELL command (as someone 
posted here before - I'm sorry I don't remember who) to bump up the
environment area size.  There seemed to be no effect on PATH.  Anyway, 
what follows are edited copies of CONFIG.SYS and AUTOEXEC.BAT.  Please 
help me get a longer PATH.  I think the Environment area is OK.

-----------------------------CONFIG.SYS--------------------------------
COUNTRY=001
BREAK=ON
DEVICE=VEMMSIME.SYS M=24
DEVICE=VEMM.SYS D=24
DEVICE=ANSI.SYS
DEVICE=VDISK.SYS 384 512 64 /E
HANDLES=20
FILES=23
LASTDRIVE=H
BUFFERS=20
STACKS=10,128
SHELL=COMMAND.COM/E:512/P


-----------------------------------------------------------------------

-----------------------------AUTOEXEC.BAT------------------------------
	Note:  I added the carriage return in the middle of the PATH
		statement so that it would fit within 80 characters.
ECHO ****************************************************************
ECHO ** Establish the PATH to search for programs on this system.  **
ECHO ****************************************************************
PATH F:\;C:\;C:\PCTOOLS;C:\SEDT;C:\BIN;C:\MOUSE;C:\UTIL\PROCOM;C:\TP;
C:\MYM;C:\SMART;E:\;E:\TC;E:\TASM;E:\MASS11;E:\GEORGE\A86;E:\M2;
REM							  ^this part gets
REM							   left off if I
REM							   do a SET command
ECHO ****************************************************************
ECHO ** Load the LIMS Extended Memory drive.                       **
ECHO ****************************************************************
VEMMCONF C: /E
REM
CHKDSK C:
CHKDSK D:
CHKDSK E:
CHKDSK F:
REM
ECHO ****************************************************************
ECHO ** Load the user programs:  assemblers, compilers, word       **
ECHO ** processors, utilities, and other programs into the         **
ECHO ** environment.  All user programs are loaded here.           **
ECHO ****************************************************************
SET SEDT=C:\SEDT\
SET PROCOMM=C:\UTIL\PROCOM\
SET M11DFALT=E:\MASS11\M11DFALT.DAT
SET M11KBRD=DEC
SET TPC=C:\TP\
SET TURBO=C:\TP\
SET A86=E:\GEORGE\A86\
SET M2=E:\M2\
REM
ECHO ****************************************************************
ECHO ** Make DOS commands resident within extended memory.         **
ECHO ****************************************************************
COPY C:\COMMAND.COM F:
SET COMSPEC=F:\COMMAND.COM
CLS
VER
REM 
-----------------------------------------------------------------------

That's the whole mess, less some TSR installations, extraneous commands,
and comments.  I've already looked at the DOS 3.3 manual, the "DOS Power 
User's Guide", and the "IBM PC-DOS Handbook" with no real results:

    1.	Yes, I know I can do a SUBST command, but I would prefer another, 
	cleaner way (if possible).
    2.	Yes, I know the SHELL command can expand the environment (I've
	already got it upto 512 (see above).

Please, no flames for overtly stupid settings - VAX/VMS is my forte.
But I sure would appreciate hearing some guidance from a few of you 
experts out there.  If you wish, email to me and I will summarize.

Thanks,

George
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  George J. Pandelios				ArpaNet:  gjp@sei.cmu.edu
  Software Engineering Institute		usenet:	  sei!gjp
  4500 Fifth Avenue				Voice:	  (412) 268-7186
  Pittsburgh, PA 15213
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"YoyoDyne Propulsion Systems:  Where the Future begins Tomorrow"
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Disclaimer:  These opinions are my own and do not reflect those of the
	     Software Engineering Institute, its sponsors, customers, 
	     clients, affiliates, or Carnegie-Mellon University.  In fact,
	     any resemblence of these opinions to any individual, living
	     or dead, fictional or real, is purely coincidental.  So there.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

nebezene@ndsuvax.UUCP (Todd M. Bezenek KO0N) (07/27/89)

In article <3695@i.sei.cmu.edu> gjp@sei.cmu.edu (George Pandelios) writes:
>Greetings Netlanders!
>
>I'm having trouble setting my PATH to a length larger than an small 
>(127?) number of characters.

Try putting a "shell=..." into your config.sys.  This will start
a new shell (in your case DOS).  With this new DOS shell, you can
specify the environment size with the /e option.

--
Todd Michael Bezenek, KO0N
         nebezene@plains.nodak.edu
UUCP:    uunet!ndsuvax!nebezene
Bitnet:  nebezene@ndsuvax
         NU040889@ndsuvm1

davidr@hplsla.HP.COM (David M. Reed) (07/28/89)

My experience is that while you can expand the size of the DOS environment,
none of the environment variables can take more than ~128 bytes.  When I 
found that I could not increase the length of my PATH variable I began to
use a variety of tricks.  One thing is to use short directory names (2-4
characters):

(okay)            PATH=C:\BAT;C:\UTIL;C:\DOS;C:\WIN

And while I like to have a fairly structured directory system, I try to make 
certain that and directory that needs to be in the search path is at the root
level, thus avoiding the lenthy /dir/subdir names:

(not okay)        PATH=C:\USR\BIN;C:\USR\LOCAL\BIN;C:\USR\CONTRIB\BIN
(okay)            PATH=C:\BIN;C:\LBIN;C:\CBIN

One trick I have not used but know of is to use the SUBST command preceeding
the PATH statement.  That way you can assign a psuedo-drive letter to a
path which makes for much shorter entries:

(in CONFIG.SYS)   LASTDRIVE = Z

(in AUTOEXEC.BAT) SUBST E: C:\USR\LOCAL\BIN
                  PATH=C:\;E:

The most recent thing I have been doing is to keep directories out of the
PATH variable that are not used frequently, or do not have a lot of programs
to be found in them.  (Generally I have a directory in the search PATH only
if it has a lot of programs.)  I start my major applications from BATch files
(all of which I place in the C:\BAT directory), that way their directory does
not need to be in the search PATH:

(C:\BAT\JUNK.BAT)   ECHO OFF
                    PUSHDIR > NUL
                    C:
                    CD \PROG_DIR
                    PROGRAM %1 %2 %3 %4 %5
                    POPDIR > NUL

NOTE: I like to see the initial ECHO OFF so that I can easily distinguish
whether I am starting a program directly or indirectly, the latter being 
something I am able to modify if I need or want.

Some applications need to have their directory in the search PATH, but since 
their directory only needs to be in the search PATH while the program is 
running, then modify the PATH before starting:

(C:\BAT\WORD.BAT)   ECHO OFF
                    PUSHDIR > NUL
                    SET OLDPATH=%PATH%
                    SET PATH=%PATH%;C:\PROG_DIR
                    C:
                    CD \PROG_DIR
                    PROGRAM %1 %2 %3 %4 %5
                    SET PATH=%OLDPATH%
                    POPDIR > NUL

psfales@cbnewsc.ATT.COM (Peter Fales) (07/28/89)

In article <3695@i.sei.cmu.edu>, gjp@sei.cmu.edu (George Pandelios) writes:
> Greetings Netlanders!
> 
> I'm having trouble setting my PATH to a length larger than an small 
> (127?) number of characters.  According to the DOS 3.3 manual, that 
> is suppossed to automatically expand.  Is this really a hard limit?

I think the problem here is not the environment space, but a 
limitation in COMMAND.COM.  Commands being executed are stored
in an internal 128 character buffer, so no command can be longer
than that limit.  (That's why you get fewer characters with
SET PATH= then with just PATH).

This limit applies after variable and parameter substitution, so
even you are tempted to try something like

PATH=a;b;c
PATH=%PATH%;x;y;z

it still WON'T work.

I believe there are programs around that manipulate the environment
space directly, to allow longer variables and paths.  I never
used anything like that myself, so I don't have a reference.

-- 
Peter Fales			AT&T, Room 5B-420
				2000 N. Naperville Rd.
UUCP:	...att!peter.fales	Naperville, IL 60566
Domain: peter.fales@att.com	work:	(312) 979-8031

mju@mudos.ann-arbor.mi.us (Marc Unangst) (07/28/89)

In article <2811@ndsuvax.UUCP>, nebezene@ndsuvax.UUCP (Todd M. Bezenek KO0N) writes:
 >In article <3695@i.sei.cmu.edu> gjp@sei.cmu.edu (George Pandelios) 
 >writes:
 >>Greetings Netlanders!
 >>
 >>I'm having trouble setting my PATH to a length larger than an small 
 >>(127?) number of characters.
 >
 >Try putting a "shell=..." into your config.sys.  This will start
 >a new shell (in your case DOS).  With this new DOS shell, you can
 >specify the environment size with the /e option.

Unfortunately, this won't help.  It is impossible to set an environment
variable longer than the DOS command-line length without some fairly
extensive work-arounds.  Since 127 characters is the longest command
line you can enter (this holds true for batch files, too), you can't
set a path longer than 127 characters.  I think you'll have to use
SUBST.

--  
Marc Unangst
UUCP smart    : mju@mudos.ann-arbor.mi.us
UUCP dumb     : ...!uunet!sharkey!mudos!mju
UUCP dumb alt.: ...!{ames,rutgers}!mailrus!clip!mudos!mju
Internet      : mju@mudos.ann-arbor.mi.us

prc@erbe.se (Robert Claeson) (07/28/89)

In article <2811@ndsuvax.UUCP> nebezene@ndsuvax.UUCP (Todd M. Bezenek KO0N) writes:
>In article <3695@i.sei.cmu.edu> gjp@sei.cmu.edu (George Pandelios) writes:

>>I'm having trouble setting my PATH to a length larger than an small 
>>(127?) number of characters.

>Try putting a "shell=..." into your config.sys.  This will start
>a new shell (in your case DOS).  With this new DOS shell, you can
>specify the environment size with the /e option.

Sorry, but that won't help. COMMAND.COM *never* allows you to input anything
longer than 127 characters. What an extended environment space gives you is
room for more environment variables, but a single variable cannot be
longer than 127 characters. I've tried to spread the PATH variable out over
several lines, like

PATH=x;y;z
PATH=%PATH%;q;w;e

or something like that, but it doesn't work either. As soon as a single
variable becomes longer than the magic limit (127 characters), COMMAND.COM
complains.

If there's anyone (anything?) that knows a work-around (or have a fix) for
this, PLEASE let us know.
-- 
          Robert Claeson      E-mail: rclaeson@erbe.se
	  ERBE DATA AB

hari@soleil.UUCP (Srihari Kotcherlakota) (07/29/89)

In article <2811@ndsuvax.UUCP>, nebezene@ndsuvax.UUCP (Todd M. Bezenek KO0N) writes:
> In article <3695@i.sei.cmu.edu> gjp@sei.cmu.edu (George Pandelios) writes:
> >Greetings Netlanders!
> >
> >I'm having trouble setting my PATH to a length larger than an small 
> >(127?) number of characters.
> 
> Try putting a "shell=..." into your config.sys.  This will start
> a new shell (in your case DOS).  With this new DOS shell, you can
> specify the environment size with the /e option.
> 
> --
> Todd Michael Bezenek, KO0N
>          nebezene@plains.nodak.edu
> UUCP:    uunet!ndsuvax!nebezene
> Bitnet:  nebezene@ndsuvax
>          NU040889@ndsuvm1

I have PC/AT clone. When I try to use "SET var=value" in autoexec.bat
to install Quick C, I get the error "Enviornment out of space". Can 
someone tell me how to get around this problem?


Please reply to uunet!rutgers!soleil!hari

SriHARI Kotcherlakota
Harris Semiconductor
724 Route 202
PO Box 591
Somerville, NJ 08876-0591

Phone: (201)685-6938
FAX:           -6860

svirsky@ttidca.TTI.COM (Bill Svirsky) (07/29/89)

In article <3695@i.sei.cmu.edu> gjp@sei.cmu.edu (George Pandelios) writes:
+I'm having trouble setting my PATH to a length larger than an small 
+(127?) number of characters.
[...]
+PATH F:\;C:\;C:\PCTOOLS;C:\SEDT;C:\BIN;C:\MOUSE;C:\UTIL\PROCOM;C:\TP;
+C:\MYM;C:\SMART;E:\;E:\TC;E:\TASM;E:\MASS11;E:\GEORGE\A86;E:\M2;
+REM							  ^this part gets
+REM							   left off if I
+REM							   do a SET command

The problem has nothing to do with the environment size or the
environment variable.  The problem is that MSDOS commands are limited to
128 characters or less.  MSDOS has no problem searching a path longer
than 128 characters.  I just created a path of over 200 characters on my
Compaq running MSDOS 3.31 using the 'nset' command of the Picnix
package.  It allows concatenation of environment variables, as in 'nset
PATH=$PATH;$PATH;$PATH;d:\dl\vde', and DOS had no problem finding a
program in d:\dl\vde.  Unfortunately the MSDOS 'set' command won't do
concatenation.  Picnix is a very nice set of **ix-like utilities for MSDOS
computers.  I can't send the 'nset.exe' without the rest of the Picnix
package without violating its copyright, and it's too large to send if
there are other programs out there that will do the same thing.  If
nothing shows up in a week or so, I'll try to package Picnix and mail it
to you.  If there is enough interest, I can post it to comp.binaries.ibm.pc.
-- 
Bill Svirsky, Citicorp+TTI, 3100 Ocean Park Blvd., Santa Monica, CA 90405
Work phone: 213-450-9111 x2597
svirsky@ttidca.tti.com | ...!{csun,psivax,rdlvax,retix}!ttidca!svirsky

daven@ibmpcug.UUCP (David Newman) (08/05/89)

If you want to use cammand lines longer than 127 characters (or very long
batch file lines), you can use a shell that replaces command.com. I use
the 4dos shell, available as shareware on many bulletin boards. It has many
other facilities that make it worthwhile, including putting itself into EMS
(if you have it), command line editing, aliases, a history list, on-line help,
and so on.
-- 
Automatic Disclaimer:
The views expressed above are those of the author alone and may not
represent the views of the IBM PC User Group.