kbn@jt.dk (Kaj Birger Nielsen) (03/02/89)
In Re^2:... Leif Andrew Rump writes that a .BAT-file containing: set TEST=%TEST%1234567890 crashes his machine. He claims that this shows that DOS cannot handle environment variables longer than 128 characters. This is wrong. I have written a program (in TP 5.0) that handles environment variables with a maximum length of 255 just fine. The limit 255 is due to the TP 5.0 implementation of strings and has nothing to do with DOS. To get beyond 255, I would have to rewrite several rutines (including some from a Turbo Professional package) to make them use zero-terminated strings. I'll do this, when the need arises. FLAME ON Leif Andrew Rump, you should check things out, before you flame others for not doing so. Especially when you correctly point out the problem with half-(or less) cooked information on the net. Besides you should brush up your english. Microsoft, how about removing the constant 128 from command.com and write something a bit more general. FLAME OFF Conclusion: This trouble is caused by command.com and the maximum length of a command line. Command.com is rotten, write your own. If you can live with command.com but still need longer environment variables, write your own program to handle this. Be aware that it is not possible to make something like: setlong test=1234567890%test% work from within a batch file, as the program segment prefix area, where the command line is put, will contain no more than 128 characters! Of course you might get away with setlong test=1234567890%%test%% but then your program will have to parse %test% Warning: If you succeed in making longer variables then a batch file as simple as set path=%path% might crash your machine. "The method employed I would gladly explain, While I have it so clear in my head, If I had but the time and you had but the brain-- Lewis Carroll: But much yet remains to be said." The Hunting of the Snark.