View Single Post
Old 07-01-2009, 04:53 PM   #1 (permalink)
illyume
Registered User
 
Join Date: Jul 2009
Posts: 6
OS: Windows XP


Executing .bat file in multiple subdirectories

I have a pair of .bat files set up to modify and convert multiple .tif images in a single directory.

It's not working right. I also need to set it up to run in multiple subdirectories. (It's a large-scale image conversion I'm working on)

The first .bat file simply executes a for command:
Code:
for %%f in (*.tif) do call echo.bat %%f
The second .bat file takes that parameter, and does this:

Code:
set file=&~n1
Which should set the variable 'file' to the file's name without file extension. It then runs through a series of commands to convert the file type, set the background to transparent, and cleans up the image.

It's working well, except for a couple of things:

on Angel.tif, and Bee.tif it works fine... but then it hits Bird House.tif and the space messes up the string parser, and it ends up returning just 'Bird' instead of 'Bird House'

How do I get the spaces to stay in there?

The "set file=%file:~0,-4%" doesn't work either, because that gets messed up by the space as well.

Also, I need this .bat to function not just in the directory it's put in, but instead I need to modify it somehow to run in each of the subdirectories 2-4 folders deeper than the current directory, and do the same thing to the files in those subdirectories. And... some of the folders have white space in their names too. Does anyone know how to make this all work?

Last edited by illyume; 07-01-2009 at 05:07 PM.
illyume is offline   Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here