I'm trying to access a file and read its content in a nested loop but the inner loop cannot access the file.. (in batch)
Here's the code (a small part of the entire script):
for %%b in (!directory!) do (
echo File used: %%b
for /f "delims= " %%c in (%%b) do (
echo %%c
)
)
The problem is:
if "%%b" equals "C:\Documents and settings\test\test.txt", the inner loop will try to access to "C:\Documents" (because of the space). If I put double-quotes around "%%b", it will parse it as a string and not the file itself.
How can I deal with that? The file is dynamic, I don't know its name...
Thanks