Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking to build a small batch script that executes the command line of pngout.exe

So far I've got only this down

for %i in (*.png) do "g:\myfiles\_pngout.exe" "%i" /s0 /c6

However, for that to work I have to manually go to each folder where the pngs are and open up a cmd window from Win7 then copy and paste that line.

What I want is for that line to work say in C:\MyPNGs and it's sub-folders, like C:\MyPNGs\Avatars etc., it should iterate through all pngs and every time execute that "g:\myfiles\_pngout.exe" "%i" /s0 /c6

Any ideas?

share|improve this question
    
Would you be opposed to using VBScript? I'm not that experienced with batch scripts, but I could write you something that does this in VBScript in 10 minutes. –  roryap Apr 5 at 21:55
    
Nah, VBScript is fine too. I would just need to read up how to run it. Should be easy doable. –  Don Salva Apr 5 at 22:18

1 Answer 1

up vote 1 down vote accepted

You can use the following command from a dosprompt:

for /r %f in (*.png) do _pngout.exe "%f"

or the following inside a batch file:

for /r %%f in (*.png) do _pngout.exe "%%f"

For /r also has support to give a start directory. Otherwise it'll use the current directory and get every file in all subdirectories that match your filemask.

share|improve this answer
    
Cheers! That did it! –  Don Salva Apr 6 at 11:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.