I'm trying to do some things during the pre-build phase of a visual studio project. Specifically, I'm trying to execute some commands on all *.resx files within the project. Here is what I have but it doesn't work when the files/directory path have a space in them. How do I get around these spaces?
for /f %%a in ('dir /B /S *.resx') do echo "%%a"
To generate a simple file list of all the relevant files for later processing
You are running into inadvertant use of the default space delimeter. You can fix that by resetting the delims like so:
You could also install cygwin to get a full-blown Unix-esque shell, which comes with the trusty old "find" command, plus a bunch of other tools. For example,
You know that
for
can also run recursively over directories?Much easier than fiddling with delimiters and saves you from running
dir
.Stick with the For text parser of the shell
just add a delims option (for a delim character which obviously couldn't exist), et voila!
In the absense of this delims option, /f will do what it is supposed to, i.e. parse the input by splitting it at every space or tabs sequence.
You can use findutils for Windows - it includes both "find" and "xargs"