Autoexec question, Please help!!

I am trying to set the environments in autoexec.bat from my installer . The environments work fine on a few machines but on others the environments (which are quite long) automatically go in to the next line (breaking the environment). I tried to manually edit the autoexec.bat merged both lines and when I reboot next again the line is truncated , and appears in the next line. Please help !!

I have observed that the environment variable breaks exactly after 255 characters
LVL 2
aziz061097Asked:
Who is Participating?
 
linda101698Connect With a Mentor Commented:
aziz,
There seems to be a lot of useful information here.  I'm posting an answer so this question can be saved in the previously asked questions.

Linda Gardner
Customer Service @ Experts Exchange
0
 
aziz061097Author Commented:
Edited text of question
0
 
cmcgeeCommented:
Here is a Technet article about this that should address your problem.

Maximum Line Length and Count for Batch Files & CONFIG.SYS
Last reviewed: November 21, 1994
Article ID: Q69563  
The information in this article applies to:
Microsoft MS-DOS operating system versions 3.x, 4.x, 5.x, 6.0, 6.2, 6.21, 6.22


SUMMARY
This article contains information on the maximum number of lines and line length allowed for batch files (including the AUTOEXEC.BAT file) and the CONFIG.SYS file.



MORE INFORMATION


Batch Files
There is no apparent limit. A test batch file with 67,000 lines and a total of 804,000 bytes ran all the way through (but it took 15 minutes to do so on a 386/33 machine). COMMAND.COM reads one batch line at a time, and only retains a file pointer for the batch file, so it does not require a large buffer to hold batch file commands before processing them. This should allow for batch files that span an entire disk, if so desired.

Each batch file line does have a limit, however. Any batch file line exceeding 127 bytes is truncated at 127 bytes before it is processed.



CONFIG.SYS File
There is no limit on lines, but there is a 64-kilobyte (65,534 byte) limit on the overall file size. A test with a CONFIG.SYS that contained only 76- byte long REM statements (except for the last line, which loaded a device driver) loaded properly. There do appear to be some problems on the boundary condition when the CONFIG.SYS file size reaches 65,535 bytes.

Each CONFIG.SYS line does not appear to have a limit. The device driver INIT code is given a pointer to a read-only buffer, which contains the remainder of the CONFIG.SYS file, not just the command line. With this pointer, you can access a command line of any length.

 
Hope this helps
Craig
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
aziz061097Author Commented:
Hi Craig,

        Your article is informative, but does not give any way to solve the problem. What do I add to config.sys ?

Thanks
Aziz
0
 
aziz061097Author Commented:
The difference in the working and not working machines is one is version Windows95 (4.00.95) and other is Windows95 (4.00.1111)   . I found this out by typing "ver" in the command prompt.
 
 
   
 

0
 
smeebudCommented:
aziz,
please post your autoexec.bat and config.sys.

Bud
0
 
aziz061097Author Commented:

Autoexec.bat has :

SET BLASTER=A220 I5 D1 T4
REM - BY WINDOWS SETUP - C:\WINDOWS\COMMAND\MSCDEX.EXE /D:TEAC-CDI /M:15
SET ND=C:\ND\ND40
SET PATH=.;C:\jdk1.1.6\bin;%ND%\VBroker\bin;%ND%\Program;
SET NETDYN_CLASSPATH=.;%ND%\Classes\nd_server_4x.jar;%ND%\Classes\nd_studio_4x.jar;%ND%\VBroker\lib\vbjorb.jar;%ND%\VBroker\lib\vbjapp.jar;%ND%\VBroker\lib\vbjtools.jar;%ND%\VBroker\lib\vbjgk.jar;%ND%\Classes\AFC.zip;%ND%\Classes\ob.jar;%ND%\Classes\GXGri
d.jar;C:\jdk1.1.6\lib\Classes.zip;%ND%\Projects;
SET NETDYN_CLASSPATH_MS=.;%ND%\Classes\nd_server_4x.jar;%ND%\Classes\nd_studio_4x.jar;%ND%\VBroker\lib\vbjorb.jar;%ND%\VBroker\lib\vbjapp.jar;%ND%\VBroker\lib\vbjtools.jar;%ND%\VBroker\lib\vbjgk.jar;%ND%\Classes\ob.jar;%ND%\Classes\GXGrid.jar;%ND%\Project
s;
SET CLASSPATH=%ND%\Classes\nd_client_4x.jar;C:\jdk1.1.6\lib\Classes.zip;%ND%\Projects;
SET OSAGENT_PORT=14020
SET MY_PATH=003456789001345678900234567890033456789004345678900534567890063456789007345678900834567890093456789010345678901134567890123456789013345678901434567890153456789016345678901734567890183456789019345678902034567890213456789022345678902334567890243
4567890253456789026345678902734567890283456789029345678903034567890


Config.sys has :
shell=C:\WINDOWS\Command.com C:\ /P /E:4096 /L:1024 /U:255
DEVICE=C:\WINDOWS\HIMEM.SYS
dos=high
FILES=40
DEVICE=C:\TEAC_CDI.SYS /D:TEAC-CDI
device=C:\WINDOWS\cwbinit.exe /A


0
 
rmarottaCommented:
I think there is a line length limit of 255 characters for a Dos statement.
Regards,
Ralph

0
 
smeebudCommented:
aziz,
The answer would be to make two path statements, put part of that very long path in one and the rest in the other.

Bud
0
 
rmarottaCommented:
Bud,
The path statement is still limited to 256 characters.

aziz,
Why do you find it necessary to use such a long path?

Ralph

0
 
aziz061097Author Commented:
Sorry craig I had to reject your answer because that does not solve my problem. I think the only solution as I had thought was in splitting the variables in to multiple parts. The strange thing is it works on some Windows 95 machines and does not on others.
0
 
alexoCommented:
Turn the auto-wrap off in notepad? (or any other editor that you use)
0
 
smeebudCommented:
Please reply to Ralph's question;
"Why do you find it necessary to use such a long path?"
Bud
0
 
aziz061097Author Commented:
Bud and Ralph,

         The PATH itself is small but the other variables like NETDYN_CLASSPATH need to have all the components for java classes . In our product we use this variable as CLASSPATH and this cannot be modified .

-Aziz
0
 
smeebudCommented:
Try changing SET PATH=
to
PATH=

Bud
0
 
adamggCommented:
smeebud - try reading the question before giving useless and irrelevant answers!
0
 
kinkajouCommented:
Aziz,

One way we get out of the path limitation problem is to SUBST drives with long directory names. For example: if I wanted to add c:\windows\system, c:\progra~1\dev\bin and c:\progra~1\dev\include directories I could add the following to my autoexec.bat:

LASTDRIVE=Z

SUBST M: C:\WINDOWS\SYSTEM
SUBST N: C:\PROGRA~1\DEV\BIN
SUBST O: C:\PROGRA~1\DEV\INCLUDE

PATH=M:\;N:\;O:\

is significantly shorter than:

PATH= C:\WINDOWS\SYSTEM;C:\PROGRA~1\DEV\BIN;C:\PROGRA~1\DEV\INCLUDE

Another way is to isolate executables/batches into one directory.

If this solve's your problem, let me post the answer.

Good Luck!
Kinkajou
0
 
smeebudCommented:
I did read the question aziz.
Tell me please what is useless and irrelevant about it.
Also did you even try my suggestion?

Bud
0
 
kinkajouCommented:
From my reference specifically says that "SET PATH=" is the equivalent of "PATH=".
0
 
aziz061097Author Commented:
just a clarification for smeebud that it was not me who said that the answers were irrelevant. But how will it solve my problem if I take off SET, it might just reduce 4 characters. That still would not solve the problem.

Kinkajou,
     Thanks for the answer but that would require too many substitutions, instead I was planning to break the variables in to multiple iterations
for example
NETDYN_CLASSPATH=%NETDYN_CLASSPATH%;C:\jdk1.1.6\lib\Classes.zip;
this solves my problem.
     I am looking for a solution something like I set a parameter in config.sys or run a command before setting the environment so that the large line does not break.

     Since everything works fine on a few machines I just want to know if anybody knows what the difference might be or where I can look for this difference.

     I shall keep this question open for sometime and until then use the multiple iteration solution that works everywhere.

     Thanks everybody for the comments and answers

-Aziz
0
 
rmarottaCommented:
What is the difference (if any) in Windows95 version numbers between those machines that work and those that do not?
Ralph


0
 
aziz061097Author Commented:
The difference in the working and not working machines is : one is version Windows95 (4.00.95) and other is Windows95 (4.00.1111)   . I found this out by typing "ver" in the command prompt.
 

0
 
rmarottaCommented:
Okay aziz, the 4.00.1111 is Win95B, sometimes called "OSR2".
I think a clue to your problem may be in the fact that the command interpreter is different between versions.
Perhaps the new one permits the long line in Dos that you need, where the earlier version will not.
I don't think they can be interchanged though, so there may not be a simple solution.
I'm going to do some digging, and I'll let you know if I find something that helps.
Maybe another expert has ideas about this?
Regards,
Ralph


0
 
gfueyoCommented:
Searching and digging, I hope I can have an answer soon.
Ralph, your comments are helpfull, so I'll thank you if you can add more, a soon as you find something...
I'll try to do it miself to help aziz.
gracias
0
 
smeebudCommented:
If I were you I'd go to
http://www.compuclinic.com/osr2faq/

One of the best OSR2 sites.
Bud
0
 
tbaffyCommented:
Aziz,
This whole thread just underscores the reasons why MS tried to get rid of environment variables in Win95.  Use of the environment in applications is old technique and considered *obsolete at best*.  The operating system limit of 256 characters in the path is often exceeded by installations that use paths extensively.  There is no need to program this way.  It is entirely possible to save a list of file locations in the registry and refer to them inside the program in order to locate files.  That is the way things are supposed to be done in Win95.  If you are programming the offending application yourself you *really* need to learn how to use the registry properly.  If you are using a program from a vendor you need to tell them to *GET IT TOGETHER* and learn how to leave DOS behind.  Continuing to use this technique will eventually result in problems that you can't solve.  I have seen it before.  You are already forced into convoluted answers to support this method.

Tom
0
 
rmarottaCommented:
Tom, I totally agree!
Would you know of a reference that may exist for determining whether or not the newer command.com has extended the 256-character limit?
Ralph

0
 
tbaffyCommented:
Ralph,

I went searching for this information while I was trying to figure out what to say about this question.  As far as I can tell the 256 character limit still exists but I have not tested it.  I am going to run some tests on different versions of Win95 and see what happens.


Tom
0
 
rmarottaCommented:
Hmmmm,
Somehow, it's working on some machines.  I just thought the command interpreter might be a connection.  Maybe not.....

Ralph

0
 
aziz061097Author Commented:
Tom and Ralph,
     Thanks for your comments. Yes I too am feeling that usage of the "DOS" way should be abandoned and instead use Registry . I wonder why the Windows95 environment cannot be set by setting the registry (as in Win NT). If the "DOS" way is to be abandoned then there has to be other automatic way.


0
 
tbaffyCommented:
You can set the Windows 95 environment using the WINSET program in the admin folder of your Win95 CDROM.

Tom
0
 
aziz061097Author Commented:
Tom,

    I did not know of the WINSET program , is this universal for all versions of Windows95 ? I will check this up myself, but I'd be very grateful if you could give a solution which will work on all Windows95 versions . If this comes only in the later versions can I ship this program with my installer (what else is needed to run this ??) and set the environment in a similar fashion. This is a new and interesting turn. Thanks .

Aziz
0
 
tbaffyCommented:
Aziz,

I have verified that Winset is included with all versions of Win95 in the \ADMIN\APPTOOLS\ENVVARS folder on the CDROM.  It has the same syntax as the standard set command but will set the environment for Win95 rather than the DOS compatibility box.

I also checked on the ability to increase the size of the DOS command line in Win95.  There is a white paper in the MS Knowledgebase that says that the Win95 command line is actually limited to 127 characters unless you specify the /u: parameter on a SHELL command in your CONFIG.SYS file.  Apparently the maximum value for this parameter is actually 250. Hence, you should put this line in your CONFIG.SYS:

SHELL C:\COMMAND.COM C:\ /U:250 /E:1024 /P

This line will make your environment space 1 KB and increase the size of the command line to its maximum allowed value.  This will impact both the real DOS prompt and all DOS compatibility boxes.


Tom
0
 
hankcCommented:
aziz, I must duck under the table and put on my dumb-dumb hat and ask, what the line in your autoecec.bat file is supposed to be for? I have never seen a line like that in any aut.... file like that.  Please forgive my ignorance and enlighten me.
Thanks
0
 
aziz061097Author Commented:
The last line in the Autoexec is just a dummy line to see where the line breaks . The problem lines are NETDYN_CLASSPATH and NETDYN_CLASSPATH_MS.
0
 
hankcCommented:
Da?????   Thanks I'll screw my head back on right!!

I noticed semi-colon inserted just after
SET NETDYN_CLASSPATH=
and
SET NETDYN_CLASSPATH_MS=

Is this a typo or are you sure they're supposed to be there?

0
 
rmarottaCommented:
Hmmmmmm,
Seems like I remember something from my Dos days telling me that "trailing semi-colons cause unpredictable results".
Could this be what they were talking about?
Ralph

0
 
aziz061097Author Commented:
Sorry guys , I am closing this question. I had to resort to multiple iterations of setting the env variables.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.