-2

My problem is, i want to batch convert these textures using a .exe that i have, it does not support batch drag and drop but i managed to create a .bat with the help of this thread here on the site and made this adaptation:

:LOOP
rem check first argument whether it is empty and quit loop in case;
rem `%1` is the argument as is; `%~1` removes surrounding quotes;
rem `"%~1"` therefore ensures that the argument is always enclosed within quotes:
if "%~1"=="" goto :END
rem the argument is passed over to the command to execute (`"%~1"`):
"E:\project\export\gtf\GTFS\0000gtf2dds.exe" "%~1"
rem `shift` makes the second argument (`%2`) to be the first (`%1`), the third (`%3`) to be the second (`%2`),...:
shift
rem go back to top:
goto :LOOP
:END

It works wonders with less than 100 files, but i have 22.000 and when i drag them all it returns a file name or extension is too long error, i googled and it seems that windows can't handle enormous lines like e.g:

 "E:\project\export\gtf\GTFS\0000gtf2dds.exe" "tex.gtf" "tex.gtf"
 "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf"
 "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf" "tex.gtf"
 "tex.gtf" "tex.gtf" +20.000 files

So i need help to figure out how to optimize this or bypass it to work with either dragging a folder or all the 22k files at once. Im new to coding and batching, so take it easy on me please :).

  • Take a look at the help information for the `For` command: `For /?` – Compo Feb 12 '18 at 20:37
  • 1
    It can't work for many files. Because there is a limit for the length of all parameters of 2048 characters – jeb Feb 12 '18 at 21:02
  • Please take the [tour], read [Ask] and [MCVE]. What you posted is okay on the MCVE point, but it's some code you copied from somewhere and you're not showing much effort in figuring out how to solve this problem on your own. We're not a coding service. – jwdonahue Feb 12 '18 at 22:14
  • Thanks Compo! The `For` command was what i needed! And mr. obvious (jwdonahue), i read before ask and yes im taking effort on solve my problem. @edit: i solved btw. – MasterZeroFX Feb 12 '18 at 22:21
  • @MasterZeroFX, post and mark the answer then. – jwdonahue Feb 12 '18 at 22:28

1 Answers1

0

Thanks @Compo after following your advice and exchanging ideas with a friend i solved my issue, here's the command that i used for my case.

FOR %A IN (*.gtf) DO gtf2dds.exe "%A"

I was able to answer this only today, because travel.