[comp.sys.ibm.pc] DOS enviroment size

wb8foz@ncoast.UUCP (02/17/87)

 Hello netlanders:
I do not seem to be able to expand the size of my 
enviroment. This is under Zenith MS-DOS 3.1, but I
have the same problem under PC-DOS 3.1 on a 6300.
I have a batch file called 'pathos.bat {flames>dev/null}
that is run as the last step in autoexec.bat. Despite
the shell command in config.sys, my path is truncated at/near
the 127th character. But! "set"s after it in the pathos are
installed ok. I am guessing my problem has to do with
maximum length of the buffer, etc. But if so, how can
I break up the "path=........" into many lines, as I have lots
more subdirs that are not making it into the path area now
here is my CONFIG.SYS
SHELL=C:\COMMAND.COM C:\ /P/E:50
device=\xmm.sys 512 0 e0 512 218
device=\vdisk.sys 512 /E
DEVICE=ANSI.SYS
DEVICE='RAMDRV.SYS
files=20
buffers=20
LASTDRIVE=ee
and my pathos.bat
path d:\;c:\;c:\cpsw\bi;c:\cpsw\isi;c:\exe\util;c:\exe\dos;c:\exe\tasm;c:\mwc;c:\exe\comm;c:\rb5;c:\exe\ws;c:\cpsw\rfs;c:\backmstr;C:\GEMSYS;C:\GEMBOOT;C:\gem\bridge
set PROCOMM=c:\EXE\COMM\
set ARCTEMP=d:\
set CCHEAD=-v -vcsd -xcc:\cpsw\mwc\ -xtd:\ -xod:\


Please EMAIL any suggestions, if enough interest exists, I
will post the solutions offered.
Thanks



-- 

		      decvax!cwruecmp!ncoast!wb8foz
			ncoast!wb8foz@case.csnet 
		(ncoast!wb8foz%case.csnet@csnet-relay.ARPA)

    	         		"SERIOUS?
		Bones, it could upset the entire percentage!"

	NRO Mossad intercept igniters plutonium Ollie North Tehran	

tim@j.cc.purdue.edu.UUCP (02/18/87)

Here is some info about setting DOS environment variables what to do
about more environment space.  First, how do you change the amount of
space?  If you have DOS prior to 3.xx then you must modify COMMAND.COM
to change the space allocation, if you have DOS 3.[01] then you can use
the SHELL variable in your CONFIG.SYS and set the space in units of
PARAGRAPHS (16 bytes).  If you have DOS 3.2 then the units are in bytes.

I don't remember how much is set initially, but you can enter variables
and definitions for them as long as you do not run any programs,
including BAT files.  If you do, then the environment space is fixed at
127 more bytes than what you are currently using.  That is why an
AUTOEXEC.BAT file setting en vars will run out of space, but if you do
it from the keyboard you will not.  This is somewhat described in the
DOS manual.  By the way, as far as I can tell, the 127 extra bytes
talked about in the previous sentences is not true if you expand the
space using the SHELL variable in the CONFIG.SYS.
-- 
Timothy Lange
PC Learning Resource Center
Purdue University Computing Center
West Lafayette, IN  47907
317-494-1787
tim@j.cc.purdue.edu

brian@prism.UUCP (02/23/87)

There is a problem with typing *any* command to dos which is larger than
128 bytes in length -- that is why you may have 16K of environment space,
but your path is only 124 bytes long (if you use SET PATH =), or 128
bytes long (if you use PATH =).

I wrote a program that lets you "set" your path in two pieces, and then
joins them together to make one large path.  It does some real no-no's
as far as poking around in dos goes, but runs ok on Compaq 286's and
Ibm-pc's under 3.x.

If you want a copy, mail me...the source code is in turbo pascal...


    
----
Brian K. Moran  brian@mirror.TMC.COM	
               {mit-eddie, ihnp4!inmet, wjh12, cca, datacube}!mirror!brian
Mirror Systems	2067 Massachusetts Avenue  Cambridge, MA, 02140
Telephone:	617-661-0777 extension 141

"Won't somebody tell me, just who and what I did...
 Why's this ring on my finger, and who's that screaming kid? " 
   From "Lost Weekend" by the Beat Farmers
---

bobmon@iuvax.UUCP (02/26/87)

brian@prism.UUCP writes:
>
>I wrote a program that lets you "set" your path in two pieces, and then
>joins them together to make one large path.  It does some real no-no's
>as far as poking around in dos goes, but runs ok on Compaq 286's and
>Ibm-pc's under 3.x.
>
>If you want a copy, mail me...the source code is in turbo pascal...

Please -- either post this to the net, or e-mail me a copy (or both :-)
There's been some discussion of this, and I've spent much time failing to
work around that stupid limit.  I'd like to know what/how you did it, as well
as having the longer path.

holtz@beowulf.UUCP (02/27/87)

The 'legitimate' way to create long path strings is to use the lastdrive
option in config.sys and the subst command.  Example:
  lastdrive=k            (say the 'real' last drive is d:)

  subst e: c:\bin\util
  subst f: c:\bin\lang
  subst g: c:\bin\games
  subst h: c:\bin\filter
  subst i: c:\bin\editors
  subst j: c:\bin\etc
  subst k: c:\bin\etc\etc
  path=d:\;c:\dos;c:\;e:\;f:\;g:\;h:\;i:\;j:\;k:\

I don't recall off hand just what the limit on lastdrive is,  but it can
go a very long way in solving large path problems.  See the DOS manual
(3.0 or beyond...)

One word of caution - if you use DOG 1.01 to optimize your disk with
substitution active,  DOS loses place of any directories which have
moved.  I find it necessary to reboot after such activity.

Fred Holtz
holtz@sdcsvax.UCSD.EDU

singhal@homxb.UUCP (02/28/87)

In article <2771@sdcsvax.UCSD.EDU>, holtz@beowulf.ucsd.edu (Fred Holtz) writes:
> 
> 
> The 'legitimate' way to create long path strings is to use the lastdrive
> option in config.sys and the subst command.  Example:
>   lastdrive=k            (say the 'real' last drive is d:)
> 
>   subst e: c:\bin\util
>   subst f: c:\bin\lang
>          ......
>   path=d:\;c:\dos;c:\;e:\;f:\;g:\;h:\;i:\;j:\;k:\
> 
By using the following lines, you can cratea a PATH as long as you like
(subject to environment size limitations) :

PATH=c:\;c:\this\that;c:\work\bin
PATH=%PATH%;c:\this\also;c:\ramres
PATH=%PATH%;c:\thats\all

(you get the idea ?)

---Sharad Singhal

holtz@beowulf.UUCP (02/28/87)

In article <119@homxb.UUCP> singhal@homxb.UUCP (S.SINGHAL) writes:
>By using the following lines, you can cratea a PATH as long as you like
>(subject to environment size limitations) :
>
>PATH=c:\;c:\this\that;c:\work\bin
>PATH=%PATH%;c:\this\also;c:\ramres
>PATH=%PATH%;c:\thats\all
>
>(you get the idea ?)
>
>---Sharad Singhal


I tried this under PC-DOS 3.1 with no luck.  I like the construct; what
DOS are you using to achieve environment variable substitution?

Fred Holtz
holtz@sdcsvax.UCSD.EDU

ljz@well.UUCP (03/01/87)

In article <2778@sdcsvax.UCSD.EDU> holtz@beowulf.ucsd.edu (Fred Holtz) writes:

>>PATH=c:\;c:\this\that;c:\work\bin
>>PATH=%PATH%;c:\this\also;c:\ramres
>>PATH=%PATH%;c:\thats\all

>
>I tried this under PC-DOS 3.1 with no luck.  I like the construct; what
>DOS are you using to achieve environment variable substitution?

Unfortunately, the above trick only works in .BAT files.  It works
with any environment variable, not just PATH.

jkg@gitpyr.UUCP (03/01/87)

In article <2778@sdcsvax.UCSD.EDU> holtz@beowulf.ucsd.edu (Fred Holtz) writes:
>>PATH=c:\;c:\this\that;c:\work\bin
>>PATH=%PATH%;c:\this\also;c:\ramres
>>PATH=%PATH%;c:\thats\all

>I tried this under PC-DOS 3.1 with no luck.  I like the construct; what
>DOS are you using to achieve environment variable substitution?

Hmmmmm.....I tried this under AT&T DOS 3.1 on my PC 6300 and it worked OK.
In fact, I wrote a little batch file "setpath" that looks like this:

set path=%PATH%;%1

so I could add any directory to the current path list. It worked perfectly.

						Jim Greenlee
-- 
The Shadow...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!jkg

Jryy, abj lbh'ir tbar naq qbar vg! Whfg unq gb xrrc svqqyvat jvgu vg hagvy lbh
oebxr vg, qvqa'g lbh?!

madd@bucsb.bu.edu.UUCP (03/01/87)

In article <2778@sdcsvax.UCSD.EDU> holtz@beowulf.ucsd.edu (Fred Holtz) writes:
>In article <119@homxb.UUCP> singhal@homxb.UUCP (S.SINGHAL) writes:
>>By using the following lines, you can cratea a PATH as long as you like
>>(subject to environment size limitations) :
>>
>>PATH=c:\;c:\this\that;c:\work\bin
>>PATH=%PATH%;c:\this\also;c:\ramres
>>PATH=%PATH%;c:\thats\all
>>
>>(you get the idea ?)
>>
>>---Sharad Singhal
>
>I tried this under PC-DOS 3.1 with no luck.  I like the construct; what
>DOS are you using to achieve environment variable substitution?

He forgot to tell you that this must be done within a batch file.  DOS
is very stupid.  Whomever decided to only do environment substitutions
and the like from batch files (and not the keyboard) should have been
shot, but we have to live with it.

I believe it will work if you throw it into a .BAT file, though I have
yet to try it.  You might also have length limitations imposed by DOS's
COMMAND.COM interpreter on environment substitutions, but I was unable
to find information about one in the Tech. Ref. manual.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   - Jim Frost * The Madd Hacker -
UUCP:  ..!harvard!bu-cs!bucsb!madd | ARPANET: madd@bucsb.bu.edu
CSNET: madd%bucsb@bu-cs            | BITNET:  cscc71c@bostonu
-------------------------------+---+------------------------------------
"Oh beer, oh beer." -- Me      |      [=(BEER) <- Bud the Beer (cheers!)

holtz@beowulf.UUCP (03/02/87)

In article <798@bucsb.bu.edu.UUCP> madd@bucsb.bu.edu.UUCP (Jim "Jack" Frost) writes:
>
>He forgot to tell you that this must be done within a batch file.  DOS
>is very stupid.  Whomever decided to only do environment substitutions
>and the like from batch files (and not the keyboard) should have been
>shot, but we have to live with it.
>
>I believe it will work if you throw it into a .BAT file, though I have
>yet to try it.  You might also have length limitations imposed by DOS's
>COMMAND.COM interpreter on environment substitutions, but I was unable
>to find information about one in the Tech. Ref. manual.
>


Thanx to all that responded telling me to use a .bat file.  Now a question:
Why does this only work in a batch file?  Also,  the SECOND substitution
I try fails (about 30% of the time).  I use the following addp.bat file:
   path=%PATH%;%1
Any explanations?   Please mail as I do not wish to tie up the net with
this any further...

Fred Holtz
holtz@sdcsvax.UCSD.EDU

singhal@homxb.UUCP (03/02/87)

In article <2778@sdcsvax.UCSD.EDU>, holtz@beowulf.ucsd.edu (Fred Holtz) writes:
> >By using the following lines, you can create a PATH as long as you like
> >(subject to environment size limitations) :
> >
> >PATH=c:\;c:\this\that;c:\work\bin
> >PATH=%PATH%;c:\this\also;c:\ramres
> >PATH=%PATH%;c:\thats\all
> >
> >(you get the idea ?)
> >
> 
> I tried this under PC-DOS 3.1 with no luck.  I like the construct; what
> DOS are you using to achieve environment variable substitution?
> 
> Fred Holtz
> holtz@sdcsvax.UCSD.EDU

The above connstruct works ONLY  in  batch  files and NOT at the DOS level. As
far as I know it works in DOS 3.1 also.

---Sharad Singhal

tr@thumper.UUCP (03/02/87)

In article <2789@sdcsvax.UCSD.EDU>, holtz@beowulf.ucsd.edu (Fred Holtz) writes:
>
> [...]
> 
> Thanx to all that responded telling me to use a .bat file.  Now a question:
> Why does this only work in a batch file?  Also,  the SECOND substitution
> I try fails (about 30% of the time).  I use the following addp.bat file:
>    path=%PATH%;%1
>
> [...]
> 
> Fred Holtz
> holtz@sdcsvax.UCSD.EDU

I suppose that you have tried this two different ways and have not 
noticed.  There are two ways to set the path.  One is with the PATH
command and the other is with the SET command.  PATH is used as:

	PATH=\WHATEVER;...

whereas SET is used as:

	SET PATH=\WHATEVER;...

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?

--
Tom Reingold

INTERNET:       tr@bellcore.com
--------
UUCP:
----                                  decvax\
                                ucbvax\       \
     lll-lcc\              ihnp4!mhuxt!ulysses!faline!flash!tr
      seismo!rutgers!mit-eddie!allegra/       /
                       watmath!clyde!bellcore/

-- 
Tom Reingold
INTERNET: tr@bellcore.com
UUCP: ..!{decvax,ulysses,bellcore}!faline!flash!tr

bright@dataio.UUCP (03/02/87)

In article <2778@sdcsvax.UCSD.EDU> holtz@beowulf.ucsd.edu (Fred Holtz) writes:
>In article <119@homxb.UUCP> singhal@homxb.UUCP (S.SINGHAL) writes:
>>By using the following lines, you can cratea a PATH as long as you like:
>>PATH=c:\;c:\this\that;c:\work\bin
>>PATH=%PATH%;c:\this\also;c:\ramres
>>PATH=%PATH%;c:\thats\all
>I tried this under PC-DOS 3.1 with no luck.  I like the construct; what
>DOS are you using to achieve environment variable substitution?

That won't work from the DOS command line, it has to be in a .BAT file.
Environment variable substitution works with 3.1.

perry@omepd.UUCP (03/02/87)

In article <119@homxb.UUCP> singhal@homxb.UUCP (S.SINGHAL) writes:
>By using the following lines, you can cratea a PATH as long as you like
>(subject to environment size limitations) :
>
>PATH=c:\;c:\this\that;c:\work\bin
>PATH=%PATH%;c:\this\also;c:\ramres
>PATH=%PATH%;c:\thats\all
>
>(you get the idea ?)

Yes, that's the theory. Unfortunately, COMMAND.COM uses a 128-byte internal
line buffer even during batch processing. COMMAND does NOT check for overflow
during %argument% expansion. Trying to get a line longer than 128 bytes will
overwrite some part of COMMAND and (probably) crash your machine. Sorry, no
luck this way.

P.S.: Checked and tried on MSDOS 3.1. Chances are it doesn't work on other
      versions either.
------------------------------------------------------------------------
  <<  Perry The Cynic >>	      ...!tektronix!ogcvax!omepd!inteloa!perry
						...!verdix!omepd!inteloa!perry
    (Peter Kiehtreiber)		      -or try- perry@inteloa.intel.com

perry@omepd.UUCP (03/02/87)

In article <2778@sdcsvax.UCSD.EDU> holtz@beowulf.ucsd.edu (Fred Holtz) writes:
>In article <119@homxb.UUCP> singhal@homxb.UUCP (S.SINGHAL) writes:
>>PATH=c:\;c:\this\that;c:\work\bin
>>PATH=%PATH%;c:\this\also;c:\ramres
>>PATH=%PATH%;c:\thats\all
>
>I tried this under PC-DOS 3.1 with no luck.  I like the construct; what
>DOS are you using to achieve environment variable substitution?
>
For some inscrutable reason, environment substitutions (%name%) work only
during batch file execution. If you try them on the keyboard, it just ignores
you...


------------------------------------------------------------------------
  <<  Perry The Cynic >>	      ...!tektronix!ogcvax!omepd!inteloa!perry
						...!verdix!omepd!inteloa!perry
    (Peter Kiehtreiber)		      -or try- perry@inteloa.intel.com

scott@ubvax.UUCP (03/03/87)

In article <119@homxb.UUCP>, singhal@homxb.UUCP (S.SINGHAL) writes:
>In article <2771@sdcsvax.UCSD.EDU>, holtz@beowulf.ucsd.edu (Fred Holtz) writes:
>> 
>> The 'legitimate' way to create long path strings is to use the lastdrive
>> option in config.sys and the subst command.  Example:
>>   lastdrive=k            (say the 'real' last drive is d:)
>> 
>>   subst e: c:\bin\util
>>   subst f: c:\bin\lang
>>          ......
>>   path=d:\;c:\dos;c:\;e:\;f:\;g:\;h:\;i:\;j:\;k:\
>> 
> By using the following lines, you can create a PATH as long as you like
> (subject to environment size limitations) :
> 
> PATH=c:\;c:\this\that;c:\work\bin
> PATH=%PATH%;c:\this\also;c:\ramres
> PATH=%PATH%;c:\thats\all

Actually, there's a much more severe restriction than the environment
size--a DOS command line is limited to 128 bytes (or so).  The %PATH%
substitution from the environment is done before the command is parsed,
and is subject to that limit.

Last I heard, the %environment-name% mechanism (which many today have
correctly posted only works within batch files) is undocumented, so like
/e:nn in the SHELL command and the various commonly-known DOS patches
you should use at your own risk.  I can vouch that the %...%
substitutions work fine in both DOS 3.2 and 3.1.

On the subject of environments and paths, there are all kinds of
options.  I use a combination of all of these:

1) Expand your environment.  I use the /e:nn in the SHELL command, but
patching COMMAND.COM will work fine too.  This isn't needed for a long
path, but you'll probably want it to set all the other environment
strings which are so useful.

2) Keep directory names short (this goes a long way!).  Also, deep trees
waste characters in pathnames.

3) The SUBST method above is very good, but results in a somewhat
unreadable PATH.  I use it just to shorten my pathnames.  What I have
done is put all my executable directories just below a single directory
named SYS; then I "SUBST S: C:\SYS".  My resulting path is pretty short:

	PATH=d:;s:\BAT\;s:\BIN\;s:\DOS\;s:\LC\;s:\NET\;s:\LW\;

4) Access executables via batch files!  My BAT directory has more than
100 files!  I get four advantages:  a) a much shorter path; b)
quick-and-dirty command name aliases; c) easy to provide such useful
things as automatically printing help messages, defaulting parameters,
and other useful things that command pre-processors provide; d)
quick-and-dirty command chaining so I can type a whole string of
commands on one line.  I do this last by ending my batch files with a
line of %1 %2 %3 %4 %5 %6 %7 %8 %9, plus proper use of SHIFT.  Think
about it.

5) If worse comes to worse, put all your executables into fewer
directories.  My BIN directory is such a miscellaneous one.

While clunky and lacking in some ways, I've found it's possible to go a
long way with DOS.  You just need to play with it a while.
-- 
"Ribbit!"     Scott (Beam Me Up, Scotty!) Scheiman   Industrial Networking Inc.
  `/\/@\/@\/\       ..decvax!amd!ubvax!scott           3990 Freedom Circle
  _\ \ -  / /_           (408) 562-5572                  Santa Clara, CA 95050

madd@bucsb.bu.edu.UUCP (03/04/87)

In article <475@omepd> perry@inteloa.intel.com (Perry The Cynic) writes:
[deleted stuff on setting DOS path]
>For some inscrutable reason, environment substitutions (%name%) work only
>during batch file execution. If you try them on the keyboard, it just ignores
>you...

This is a result of an idiot designing the COMMAND.COM processor.
Whomever designed it decided that you would only want to use the
expansion when you were exectuing batch files.  Of course, we all know
that you often would like to do something like:

	set home=\very\long\path
        dir %home%
	erase %home%
	rmdir %home%

But Microsoft, in their ultimate wisdom....

(I've designed several command processors, some very very much more
talented than the DOS processor, and it really should have been hard
to disable the capability.  Therefore I assume it was done
deliberately for some unspecified reason.)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   - Jim Frost * The Madd Hacker -
UUCP:  ..!harvard!bu-cs!bucsb!madd | ARPANET: madd@bucsb.bu.edu
CSNET: madd%bucsb@bu-cs            | BITNET:  cscc71c@bostonu
-------------------------------+---+------------------------------------
"Oh beer, oh beer." -- Me      |      [=(BEER) <- Bud the Beer (cheers!)

madd@bucsb.bu.edu.UUCP (03/04/87)

In article <667@ubvax.UUCP> scott@ubvax.UUCP (Scott Scheiman) writes:
>Last I heard, the %environment-name% mechanism (which many today have
>correctly posted only works within batch files) is undocumented, so like
>/e:nn in the SHELL command and the various commonly-known DOS patches
>you should use at your own risk.  I can vouch that the %...%
>substitutions work fine in both DOS 3.2 and 3.1.

UNGH!  Wrong!  We have enough problems with undocumented stuff without
someone telling people that other things that ARE documented aren't.
Just yank your DOS manual (not even the tech ref) and look up "batch"
in the index.  Sure is documented!  I don't know about dos's before
v2.11 (because I never met one) but everything 2.11+ has it.

OK, now that that's out of my system, the rest of the suggestions were
pretty good.

>While clunky and lacking in some ways, I've found it's possible to go a
>long way with DOS.  You just need to play with it a while.

Yup.  Happy hacking.

>"Ribbit!"     Scott (Beam Me Up, Scotty!) Scheiman   Industrial Networking Inc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   - Jim Frost * The Madd Hacker -
UUCP:  ..!harvard!bu-cs!bucsb!madd | ARPANET: madd@bucsb.bu.edu
CSNET: madd%bucsb@bu-cs            | BITNET:  cscc71c@bostonu
-------------------------------+---+------------------------------------
"Oh beer, oh beer." -- Me      |      [=(BEER) <- Bud the Beer (cheers!)

wwhite@teknowledge-vaxc.UUCP (03/04/87)

> In article <667@ubvax.UUCP> scott@ubvax.UUCP (Scott Scheiman) writes:
> >Last I heard, the %environment-name% mechanism (which many today have
> >correctly posted only works within batch files) is undocumented
> 
> Just yank your DOS manual (not even the tech ref) and look up "batch"
> in the index.  Sure is documented!  I don't know about dos's before
> v2.11 (because I never met one) but everything 2.11+ has it.
> 

Well, I looked up every index reference and didn't find any mention of
substitution for environment variables. I have DOS manuals for 2.1, 3.0,
and 3.1, so if you could tell me what page to find it on I'd appreciate it.

Bill White
WWHITE@teknowledge

nather@ut-sally.UUCP (Ed Nather) (03/06/87)

In article <2778@sdcsvax.UCSD.EDU>, holtz@beowulf.ucsd.edu (Fred Holtz) writes:
> >PATH=c:\;c:\this\that;c:\work\bin
> >PATH=%PATH%;c:\this\also;c:\ramres
> >PATH=%PATH%;c:\thats\all
> >
> >---Sharad Singhal
> 
> I tried this under PC-DOS 3.1 with no luck.  I like the construct; what
> DOS are you using to achieve environment variable substitution?
> 
> Fred Holtz

This method of environment-variable substitution works fine under DOS 3.1 --
I use it regularly.  I have not tried the multiple substitutions described
above, but it appears that any construct of the form

set xx=whatever

in a batch file can be followed by a reference to the variable, as in

if %xx% == "whatnot"

will have the string from the environment substituted before the comparison
is made.  This can shorten batch files dramatically, and goes a fair way
toward overcoming the "no variables" rule in batch files.

-- 
Ed Nather
Astronomy Dept, U of Texas @ Austin
{allegra,ihnp4}!{noao,ut-sally}!utastro!nather
nather@astro.AS.UTEXAS.EDU