1

So I'm doing some texture converting, and thought I'd automate some of the process with batch, first half was done easy, now I'm kind of stuck on second half.

The process goes tga > ctex > bch

tga > ctex was easy since you can individually input and convert each file, so I used this batch script;

for %%f in (*.tga) do NW4C_TextureConverter.exe %%f --output=%%~nf.ctex --format=ETC1_A4 --etc_encoding=mediumimproved

However, this won't work from ctex to bch because I need all ctex files found to be used as a single input so that they all combine into a single bch, like so;

NW4C_h3dbincvtr -o=output.bch (ctext file1) (ctex file2) (ctex file3)...

What would be the easiest way to implement the first script so that instead of using each file individually I can append all files to the end of the second command?

DeathChaos
  • 11
  • 3
  • 1
    Join the names of all ctex files in a variable and then use its value in the second conversion... – Aacini Aug 20 '16 at 17:28
  • Thanks for the suggestion, searching for something along those lines helped me find what I needed, for future reference the answer was found [here](http://stackoverflow.com/questions/19540089/how-to-get-the-list-of-filenames-in-a-directory-and-store-that-in-a-variable-usi) and what I used was;
    `setlocal disableDelayedExpansion set "files=" for /r %%F in (*.ctex) do call set files=%%files%% "%%F" NW4C_h3dbincvtr -o=output.bch %files%` worked perfectly!
    – DeathChaos Aug 21 '16 at 02:47
  • @DeathChaos: please put that into an answer and accept it to show the issue is solved. And congrats! New users that are able to use the search function and find a solution on their own after only a short hint are rare. Too rare. – Stephan Aug 21 '16 at 08:18
  • 1
    I only suggest you to use the Delayed Expansion version instead: `set files=!files! "%%F"` that is the standard way to solve these problems; unless the filenames may contain exclamation marks. Your answer may include an explanation of these points (and I will upvote it! :). – Aacini Aug 21 '16 at 13:59

1 Answers1

0

Thanks for the suggestion, searching for something along those lines helped me find what I needed, for future reference the answer was found here and what I used was; setlocal disableDelayedExpansion set "files=" for /r %%F in (*.ctex) do call set files=%%files%% "%%F" NW4C_h3dbincvtr -o=output.bch %files%

worked perfectly!

Community
  • 1
  • 1
DeathChaos
  • 11
  • 3