[comp.sys.ibm.pc] MS-DOS Path Name Length

helen@uhccux.UUCP (Helen Rapozo) (04/27/88)

I am posting this for a friend.  If you want to reply to him
you can either send mail to me or you can call him at (808) 845-9141.


TO:      DOS knowledgeable person
FROM:    Tom Moore
DATE:    April 26, 1988

SUBJECT: DOS PATH length limit

DOS command lines seem to be limited to about 153 characters in length.
The PATH symbol is usually established on DOS command line.  Apparently
then, the PATH symbol cannot be longer than 147 characters even if the
environment space would allow for it.

What are the easiest, fastest, least costly ways to work around this
limitation?
-- 
BITNET address: helen@uhccux
UH Admin Network: HCCADA::CS_RAPOZO
US Mail Address: 874 Dillingham Blvd., Honolulu, HI 96817, Ph# (808) 845-9202
PLATO address: helen rapozo/honcc/hawaii

murillo@sigi.Colorado.EDU (Rodrigo Murillo) (04/27/88)

In article <1796@uhccux.UUCP> helen@uhccux.UUCP (Helen Rapozo) writes:
>
>DOS command lines seem to be limited to about 153 characters in length.
>The PATH symbol is usually established on DOS command line.  Apparently
>then, the PATH symbol cannot be longer than 147 characters even if the
>environment space would allow for it.
>
>What are the easiest, fastest, least costly ways to work around this
>limitation?

The standard trick is to use DOS SUBST to substitute a long directory
path with a single drive letter,  and include the letter in the path
spec rather than the path name itself.  This is only available to
3.x users only.  For example:

     subst x: c:\very\long\and\gross\path\spec
     path=x:\;etc.

Remember to place a lastdrive=z line in your config.sys file to make
all the logical drives available.  You can also refer to subdirs below
the subst-ed drive as you would any drive:  path=x:\level7  refers
to a 7th level directory below the root. Have fun!


-- 
_______________________________________________________________________________
 Rodrigo Murillo, University of Colorado - Boulder  (303) 761-0410 
 murillo@boulder.colorado.edu | ..{ncar|nbires}!boulder!murillo
 ( Machines have less problems.  I'd like to be a machine. -- Andy Warhol )

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (04/28/88)

In article <1796@uhccux.UUCP> helen@uhccux.UUCP (Helen Rapozo) writes:

>SUBJECT: DOS PATH length limit
>
>DOS command lines seem to be limited to about 153 characters in length.
>The PATH symbol is usually established on DOS command line.  Apparently
>then, the PATH symbol cannot be longer than 147 characters even if the
>environment space would allow for it.

  There was a note on my BBS a few months ago saying that you can get by
this by using a batch file and parameter substitution. I don't have a
DOS machine handy so I can't try it, perhaps a DOS user could and report
back.

  $ type foo.bat
  path this;is;a;big;long;path;at;this;point;up;to;127-char;long
  set PATH %PATH%;add;more;paths;as;needed;here;and;on;following;lines
  set PATH %PATH%;set;doesn't;use;the;command;line;buffer;perhaps
  $

  Then execute "foo" instead of the path command in your autoexec file.

NOTE: I *said* I didn't try it, I use ksh and don't have the problem.
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me

vg55611@ihuxy.ATT.COM (Gopal) (04/28/88)

Perhaps the problem can be avoided altogether by setting up one directory
(let's say c:\bin) that contains .bat files to execute your programs
stored in other directories.

This a) makes the PATH short - perhaps all it may be is: c:\bin; c;\dos;
     b) makes it shorter to find a program since all the directories in
        the path does not have to be searched.
     c) also provides a way to set up the environment for that particular
        program.  For example, let us say that a program called "someprog"
        requires an environment variable called "someenvv" to be set.  You
        can set up this variable using the batch file, execute the program,
        and then scrap this variable so that it does not take up any
        environment space.

             sp.bat =   set someenvv=whatever
                        c:\somedir\someprog
                        set someenvv=

'tis what I do and has worked well for me.  You probably want to add an
"echo off" also to the batch file.

Venu P Gopal
ihnp4!ihuxy!vg55611

kelsen@ge-dab.GE.COM (Michael S. Kelsen) (04/29/88)

   How about using logical drives to shorten the path string length?

   CONFIG.SYS:

      lastdrive=f

   AUTOEXEC.BAT:

      subst d: c:\sys\dos\files
      subst e: c:\sys\util\misc
      subst f: c:\user\language\basic\quick
      path=d:;e:;f:

   Make sure subst is in the root directory or include the full path
name for subst (ie. \dos\sys\files\subst).
-- 
   Michael S. Kelsen                 ARPA: <kelsen@ge-dab.GE.COM>
   GE Simulation & Control Systems   UUCP: mcnc!ge-rtp!ge-dab!kelsen
   PO Box 2500, Room 4351                    
   Daytona Beach, FL  32014          Phone: (904) 239-3122

David_J_Buerger@cup.portal.com (05/01/88)

Using the DOS SUBST command is a great way to shorten path lengths,
thereby getting more executables under your beckon call. . .

UNLESS you are running network software such as Novell Netware,
which sets up its own logical drives.  Eventually I had to discontinue
using SUBST for the benefit of using Netware.  If you are going to
take this route, be sure to delete the LASTDRIVE command from your
config.sys file.

David J. Buerger
dbuerger@scu.bitnet

del@Data-IO.COM (Erik Lindberg) (05/06/88)

In article <4982@cup.portal.com> David_J_Buerger@cup.portal.com writes:
>UNLESS you are running network software such as Novell Netware,
>which sets up its own logical drives.  Eventually I had to discontinue
>using SUBST for the benefit of using Netware.  If you are going to
>take this route, be sure to delete the LASTDRIVE command from your
>config.sys file.
>
>David J. Buerger
>dbuerger@scu.bitnet


I don't understand, WHY did you have to stop using SUBST for Netware? I am
using Netware on a daily basis, and have no trouble with SUBST. I use
LASTRIVE=P in my config.sys, so all drives below P: are either real devices
or SUBST'd directories. I use the Netware assignments for drives above P:

For the most part, I find the Netware implementation bogus, since if I
assign R: to SERVER:/USERS/DEL/USR/BIN, and while R: is my default drive
I issue a "CD\" I end up in the root directory of the server. Which means if
I "CD" down a few directories in my USR/BIN directory, I can't get back to it
except by typing in the whole long name again. Yuck.
-- 
del (Erik Lindberg) 
uw-beaver!tikal!pilchuck!del