Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello All! I have a formatted text file that I wish to read with a batch file for further processing. It is formatted like so:
o,object1.sql
r,report1.xml
r,report2.xml
b,table1.sql . . .
and so on, where the first character is a code which tells what kind of file it is (since some of them have the same file extensions) followed by a (,) delimiter, and the file name. I am trying to write a batch that goes through the whole file and completes the commands for each file. Here is my code:for /f "delims=," %%a in (testing.txt) do (
if %%a==o goto OBJECTS
if %%a==r goto REPORTS
if %%a==b goto TABLES
)
:OBJECTS
for /f "tokens=2 delims=," %%b in (testing.txt) do echo.This is where further commands will go on %%b
goto EOFand so on... for each type of file.
My problem is, when a match is found in the first for command, it goes to the correct section, but then it does the command for all files in testing.txt, not just the one found.
How can I get it to go through all the files, and do the neccessary command on each depending on their code? ANY help on this would be GREATLY appreciated as I have been working on this for some time now. Thank you all in advance.
Cheers,
tgghelp. me.

wait til 'the man comes around' :-)
Today's subliminal thought is: 'Calm down ... it's only ones and zeros.'
icq 10183575

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |