sword@vu-vlsi.Villanova.EDU (Ronin) (01/18/89)
Since I posted the original question about setting the path and using the environment, I have gotten many useful answers and suggestions. Here's a quick summary of what I've been told, and learned: 1. The 128 byte limit is a COMMAND.COM limitation. Setting your environment size via the SHELL=.../e:xxxx does you no good. It is true that the command line only lets you type 127 chars., but this wasn't my difficulty since I was using %PATH% in a batch file (sorry if I didn't make that clear originally). 2. The fact that the machine crashes at the 128th character only, is a bug (particular to Zenith Machines running MS-DOS 3.3. Other machines and PC-DOS don't crash). 3. There are a couple of programs to help cope with these problems (BIGPATH most readily comes to mind). These increase the size of the path. 4. Using SUBST and some common sense, I've managed to get my desired path under 128 chars. Hence my problem is solved. However, I have learned some other interesting things while all this was going on. First, the environment table (at least in MS-DOS 3.3) is stored at 0050:F0E0 (ref: IBM PC-DOS v2.00 Manual, Appendix E, Pg. E-1) An area is reserved of 128 bytes (or greater if you've used the SHELL=.../e:xxxx) for the environment. The lay-out is simple: it is one ASCIIZ string (char. string followed by a null char) after another. The final string is terminated by two null chars (00 00) which indicates the end of the table. Using DEBUG, I was able to set a path (which worked) which was approximately 370+ bytes long (I made sure to call an executable which was in a directory at the end of the long path, and it worked). So a pathname of any length is valid, provided the environment area is big enough. I have also written (as a result of all this) a program in Turbo Pascal which allows you to read input from the keyboard and places it in an environment variable which you name. The syntax is: readenv <var-name> [<prompt-string>] Example: readenv INFILE Filename: This results in the prompt, Filename: After entering data, the environment variable INFILE is created with the entered value and can be accessed in the batch program via %INFILE%. It's got a couple of bugs (with the prompt and with the environment table) which I'm trying to work-out, but the initial version works okay. The only dangers of mucking around with the environment table directory that I can foresee at this point would be: 1) finding out how big the allocation for the environment table is so you don't go beyond the boundary; 2) making sure not to trash the table which already exists. If anyone is interested in taking a look at the program (it's about 100 lines long), drop me a line and I'll send out a copy via email. Thanks to all who replied, your advice was much appreciated. ..lar ----- Larry Esmonde, Director of SWORD (Student Working On R & D) c/o CS Dept. Villanova University Villanova, Pa. 19085 UUCP : {psuvax1,bpa}!vu-vlsi!sword BITNET : 159628317@vuvaxcom, larry@villvm CSnet : esmonde@villanova.edu