Solved

Autoexec question, Please help!!

Posted on 1998-06-11
38
189 Views
Last Modified: 2013-12-16
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
0
Comment
Question by:aziz061097
  • 12
  • 7
  • 6
  • +8
38 Comments
 
LVL 2

Author Comment

by:aziz061097
ID: 1756408
Edited text of question
0
 
LVL 7

Expert Comment

by:cmcgee
ID: 1756409
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
 
LVL 2

Author Comment

by:aziz061097
ID: 1756410
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
 
LVL 2

Author Comment

by:aziz061097
ID: 1756411
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
 
LVL 14

Expert Comment

by:smeebud
ID: 1756412
aziz,
please post your autoexec.bat and config.sys.

Bud
0
 
LVL 2

Author Comment

by:aziz061097
ID: 1756413

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
 
LVL 9

Expert Comment

by:rmarotta
ID: 1756414
I think there is a line length limit of 255 characters for a Dos statement.
Regards,
Ralph

0
 
LVL 14

Expert Comment

by:smeebud
ID: 1756415
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
 
LVL 9

Expert Comment

by:rmarotta
ID: 1756416
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
 
LVL 2

Author Comment

by:aziz061097
ID: 1756417
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
 
LVL 11

Expert Comment

by:alexo
ID: 1756418
Turn the auto-wrap off in notepad? (or any other editor that you use)
0
 
LVL 14

Expert Comment

by:smeebud
ID: 1756419
Please reply to Ralph's question;
"Why do you find it necessary to use such a long path?"
Bud
0
 
LVL 2

Author Comment

by:aziz061097
ID: 1756420
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
 
LVL 14

Expert Comment

by:smeebud
ID: 1756421
Try changing SET PATH=
to
PATH=

Bud
0
 
LVL 1

Expert Comment

by:adamgg
ID: 1756422
smeebud - try reading the question before giving useless and irrelevant answers!
0
 
LVL 2

Expert Comment

by:kinkajou
ID: 1756423
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
 
LVL 14

Expert Comment

by:smeebud
ID: 1756424
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
 
LVL 2

Expert Comment

by:kinkajou
ID: 1756425
From my reference specifically says that "SET PATH=" is the equivalent of "PATH=".
0
 
LVL 2

Author Comment

by:aziz061097
ID: 1756426
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
Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

 
LVL 9

Expert Comment

by:rmarotta
ID: 1756427
What is the difference (if any) in Windows95 version numbers between those machines that work and those that do not?
Ralph


0
 
LVL 2

Author Comment

by:aziz061097
ID: 1756428
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
 
LVL 9

Expert Comment

by:rmarotta
ID: 1756429
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
 

Expert Comment

by:gfueyo
ID: 1756430
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
 
LVL 14

Expert Comment

by:smeebud
ID: 1756431
If I were you I'd go to
http://www.compuclinic.com/osr2faq/

One of the best OSR2 sites.
Bud
0
 
LVL 2

Expert Comment

by:tbaffy
ID: 1756432
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
 
LVL 9

Expert Comment

by:rmarotta
ID: 1756433
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
 
LVL 2

Expert Comment

by:tbaffy
ID: 1756434
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
 
LVL 9

Expert Comment

by:rmarotta
ID: 1756435
Hmmmm,
Somehow, it's working on some machines.  I just thought the command interpreter might be a connection.  Maybe not.....

Ralph

0
 
LVL 2

Author Comment

by:aziz061097
ID: 1756436
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
 
LVL 2

Expert Comment

by:tbaffy
ID: 1756437
You can set the Windows 95 environment using the WINSET program in the admin folder of your Win95 CDROM.

Tom
0
 
LVL 2

Author Comment

by:aziz061097
ID: 1756438
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
 
LVL 2

Expert Comment

by:tbaffy
ID: 1756439
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
 

Expert Comment

by:hankc
ID: 1756440
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
 
LVL 2

Author Comment

by:aziz061097
ID: 1756441
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
 

Expert Comment

by:hankc
ID: 1756442
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
 
LVL 9

Expert Comment

by:rmarotta
ID: 1756443
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
 
LVL 2

Author Comment

by:aziz061097
ID: 1756444
Sorry guys , I am closing this question. I had to resort to multiple iterations of setting the env variables.
0
 
LVL 7

Accepted Solution

by:
linda101698 earned 50 total points
ID: 1756445
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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now