So I typed in a simple Perl program as you indicated:
Then (and in part to remind myself why Perl is *so* much better) I typed in a batch file (WinXPSP2) to test with:#!/usr/bin/perl -w # vim:ft=perl:ts=4:sw=4:et:is:hls:ss=10: use strict; use warnings; my $the_cmd = 'dir'; printf "About to call system('%s') ...\n", $the_cmd; my $rc = system( $the_cmd ); printf "Return code from system() call was %d (0x%04X)\n", $rc, $r +c;
(oh faint of heart - shield your eyes!)
I then ran it, asking for increasing numbers of environment variables to be filled with short 100-char strings. I did hit a limit fairly quickly. Below are snippets from the output:@echo off :menu1 echo c)lear all echo f)ill a bunch echo l)ist them echo s)ize them echo r)un Perl program echo q)uit set /p zans="what to do? [cflqrs] " if "%zans%X"=="X" goto menu1 if /i "%zans%"=="c" goto docl1 if /i "%zans%"=="f" goto dofl1 if /i "%zans%"=="l" goto doli1 if /i "%zans%"=="q" goto doqu1 if /i "%zans%"=="r" goto doru1 if /i "%zans%"=="s" goto dosz1 goto menu1 :docl1 set zcount=350 set zcounter=1 :clagain rem echo I see %zcounter% and %zcount% if %zcount% LSS 1 goto :menu1 if not defined zenv%zcounter% goto menu1 rem echo Once again, doing zenv%zcounter% ... set zenv%zcounter%= set /a zcounter+=1 set /a zcount-=1 goto clagain :dofl1 --------------------------------------------------- set /p zans="how many should I fill? " if "%zans%X"=="X" goto menu1 set zcount=%zans% echo Will fill %zcount% environment variables with 100-char values :flagain if %zcount% LSS 1 goto :menu1 set zenv%zcount%=a123456789b123456789c123456789d123456789e123456789f12 +3456789g123456789h123456789i123456789j123456789 set /a zcount-=1 goto flagain :doli1 set zenv goto menu1 :dosz1 set zenv >zenv.size set >all.env.size dir zenv.size all.env.size goto menu1 :doru1 perl -w joinersw1a.pl goto menu1 :doqu1 echo okay, quitting, bye! goto :eof rem vim:ft=dosbatch:ts=2:sw=2:et:is:hls:ss=10:
how many should I fill? 260
Will fill 260 environment variables with 100-char values
10/03/2004 23:33 29,983 all.env.size
10/03/2004 23:33 28,492 zenv.size
About to call system('dir') ...
CGI-Application-MailPage-1.2.tar.gz hexdmpr.pl~ murugu1.pl
:: :: ::
hexdmpr.pl~ murugu1.pl
Return code from system() call was 0 (0x0000)
how many should I fill? 265
Will fill 265 environment variables with 100-char values
10/03/2004 23:34 30,533 all.env.size
10/03/2004 23:34 29,042 zenv.size
About to call system('dir') ...
CGI-Application-MailPage-1.2.tar.gz hexdmpr.pl~ murugu1.pl
:: :: ::
hexdmpr.pl~ murugu1.pl
Return code from system() call was 0 (0x0000)
how many should I fill? 269
Will fill 269 environment variables with 100-char values
10/03/2004 23:36 30,973 all.env.size
10/03/2004 23:36 29,482 zenv.size
About to call system('dir') ...
CGI-Application-MailPage-1.2.tar.gz hexdmpr.pl~ murugu1.pl
:: :: ::
hexdmpr.pl~ murugu1.pl
Return code from system() call was 0 (0x0000)
how many should I fill? 270
Will fill 270 environment variables with 100-char values
10/03/2004 23:35 31,083 all.env.size
10/03/2004 23:35 29,592 zenv.size
About to call system('dir') ...
Can't spawn "cmd.exe": No such file or directory at joinersw1a.pl line 9.
Return code from system() call was 65280 (0xFF00)
All I can really offer is that I can reproduce the problem, and quite close to your problem specification. I can't find any documentation at Microsoft that relates, other than their statements about 65MB max limits. (lies!)
But I do feel you should investigate one or more of the several configuration file solutions. I just have to believe it will be more manageable now and in the future.
(once over that little hiccup of totally changing the way you do things (ouch!))
In reply to Re^3: environment limitations
by shenme
in thread environment limitations
by joinersw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |