Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!cec2!news From: jcb2647@cec1.wustl.edu (James Christopher Beard) Newsgroups: comp.sys.ibm.pc Subject: Re: How can I set a PATH longer than 128 bytes ? Summary: Suggests an M.O. wherein long paths are not needed. . . Keywords: path environment Message-ID: <1990Mar8.021622.13121@cec1.wustl.edu> Date: 8 Mar 90 02:16:22 GMT References: <5762@ncrcae.Columbia.NCR.COM> <17140003@hplred.HP.COM> Sender: news@cec2 (USENET News System) Reply-To: jcb2647@cec1.wustl.edu (James Christopher Beard) Organization: Washington University, St. Louis MO Lines: 68 Sorry I can't help with the original problem, but I would like to suggest that you set things up so that an extremely long path is not needed. How about using batch files (as noted by Bob Piety) to add special-purpose directories to the path only when they are needed, then remove them automatically? There are some directories that really should be on the path all the time, and others that are useless except when you are running a particular application. By way of example, my AUTOEXEC.BAT includes the following: PATH=C:\BAT;C:\UTIL;C:\DOS SET REGPATH=%PATH% (Note that this will not work with DOS 3.0, which mishandles the variable substitution that makes "%PATH%" be understood as "C:\BAT;C:\UTIL;C:\DOS" in the above example. It works fine with 3.1 and later.) MS Word, for example, is invoked with a batch file (located in C:\BAT) that includes the lines PATH=C:\WORD;%PATH% . . .set up other stuff. . . WORD %1 %2 %3 . . . PATH=%REGPATH% The last command restores the path to the "general purpose" version that was stored in the environment variable REGPATH by AUTOEXEC.BAT. Why not have an enormous path that includes the home directory of every application on the hard disk, the way the documentation and/or installation program for so many applications recommend? For one thing, it is a substantial waste of time. Every time you invoke a program not in the current directory, the computer may search through a whole bunch of directories that contain only special-purpose programs. If you're running QuickC, and C:\DEVEL\QC2 is the 10th directory in the path, you unnecessarily search through 9 directories every time you invoke one of QC's executables with the default directory set to something other than C:\DEVEL\QC2. And every time you mistype a command name, practically the whole dang disc is searched before you see "Bad command or file name". For another thing, it wastes environment space and may exceed a hard limit on the path length (but you already know about that). (On the subject of environment space, you may well be aware already that you can have as much space as you like by putting an appropriate SHELL command in CONFIG.SYS: SHELL=C:\DOS\COMMAND.COM /P /E:nnn If you're using DOS 3.2 or later, nnn is the number of bytes to set aside for the environment. For DOS 3.1, nnn is the number of 16-byte "paragraphs" to set aside for the environment.) If your path is of horrible length for some reason other than trying to keep every known executable available at once, you can shorten the number of characters in the path by giving some of the directories "aliases" using the SUBST command a la SUBST E: C:\PROGRAMS\JOE\WORDPROC\WP Then you can include the virtual drive E: in your path. Two notes, though: 1) SUBST mustn't be used in a networked environment, which seems like the place you're most likely to need it, and 2) for the above to work, you need a command of the form "LASTDRIVE=E" in CONFIG.SYS, where you replace "E" with the name of the highest-lettered drive or virtual drive you will ever want to refer to.