In windows explorer when I drag and drop 100 files over a batch file, I get an error saying that the "data area passed to a system call was too small"
I generated the batch file to take 100 arguments like so, thinking it would work
MyProg.exe %1 %2 %3 %4 %5 ... %100
MyProg takes a bunch of paths and does things to them.
So now my solution is
for %%X in (*.my_ext) do (
MyProg.exe %%X
)
But that is initializing my program again and again since I am just passing one file to it, which sort of defeats the purpose of accepting an arbitrary number of arguments and this start-up + finish is slowing things down.
Ideally, I would like to just pass all files to my program and let it run. How would I accomplish this?
EDIT:
One idea I'm going for is this one: How to concatenate strings in a Windows batch file?
My solution now looks like this. I have two batch files get_files.bat
and main.bat
get_files.bat
@echo off
set myvar=myProg.exe
for /r %%i in (*.my_ext) DO call :concat "%%i"
echo %myvar%
goto :eof
:concat
set myvar=%myvar% %1
goto :eof
main.bat
call get_files.bat > out.bat
call out.bat
I first create the command I want to call, and then I call it. This allows me to pass 100's of paths that match the given crieria to my program, though it seems like at some point I reach the limit on how long the input string can be.
The ideal solution would look something like building as long of a list as possible and passing that list to the program, and then repeat until all files have been processed. The files may be searched recursively, etc.