[thelist] win32 perl, maxlength for @argv?

ashok at magicalkenya.com ashok at magicalkenya.com
Fri May 24 12:17:01 CDT 2002


>in win2k the properties window I get for the shortcut has these tabs:
>General, Shortcut, Options, Font, Layout, Colors, Security
>
>Options has familiar looking options - cursor size, display options,
>command history (buffer size, number of buffers), edit options -- but I
>don't see anywhere to actually change the environment memory?? does this
>live somewhere else ?

Oops , i had some old .pif files on my win2k comp (it was orig. upgraded
from win98)  - these used to have a memory setting.
In  win2k the command buffer is fixed at around 2046 bytes.   so you are
going to run in to a problem if you have a large
command line like :

c:\>abc.exe file1.txt file2.txt file3.txt......  file100.txt


windows as such does have a single command line limitation length of 32K ,
the cmd.exe imposes a much smaller limit of 2046 bytes
if you are going above the 32k limit you better rethink the way your app is
written....


i would recommend that you split up your commands into sequential calls
(that might mean changing the way your program works though...)

something like this in a batch file (i assume your files are named
sequentially ...)
for %%d in (1 2 3 4 5 6 7 8 9 10 11...) do abc.exe  file%d.txt

this will  automatically execute it against the files 1 by 1 like this :

c:\>abc.exe file1.txt
c:\>abc.exe file2.txt
....
....
c:\>abc.exe file100.txt


On the other hand , you could also try passing the command line from a
vbscript (wsf windows scripting file) program  or a proper vb
executable......which might overcome the command line length limitation


Set WshShell = CreateObject("WScript.Shell")
'take in the command line file name parameters as an InputBox
'or read in the parameters from an external text file....
strCmdLine = ...the command line params as mentioned above...
' Start the program that is placed in sAddOn
WshShell.Run "c:\\abc.exe" & strCmdLine

the wshshell.run command executes your app under the context of the
cscript.exe interepretr and as such IMO should not suffer from the 2046
byte command.com and cmd.exe limitations....

HTH
ashok








More information about the thelist mailing list