Computing.Net > Forums > Programming > consecutive loops in batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

consecutive loops in batch file

Reply to Message Icon

Name: vledda
Date: March 3, 2005 at 02:52:28 Pacific
OS: Win XP
CPU/Ram: pentium 4
Comment:

I'm trying to execute a command that selects an element from one list and another one from the second list

e.g. MP2XML el1(from list1) el2(from list2)
This is my code:


FOR %%A IN (*.akm) FOR %%B IN (*.xml) DO MP2XML FOR %%B IN (*.xml)

This doesnt work. Any ideas?

Thanks




Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: March 3, 2005 at 03:00:06 Pacific
Reply:

Hi vicky,

Do your akm & xml have "lines", ie strings terminated by CRLF pairs?

Do you need to select random elements with each run?

M2


0

Response Number 2
Name: vledda
Date: March 3, 2005 at 03:08:21 Pacific
Reply:

no, i don''t think they have lines. I just need to select one elemt from each list and then execute the command with the 2 selected elements. Any ideas?


0

Response Number 3
Name: Mechanix2Go
Date: March 3, 2005 at 03:11:33 Pacific
Reply:

Hi vicky,

So you have several akm & xml, like this?

1.akm
2.akm
3.akm
1.xml
2.xml
3.xml

?


M2


0

Response Number 4
Name: vledda
Date: March 3, 2005 at 05:14:01 Pacific
Reply:

yes thats right


0

Response Number 5
Name: Mechanix2Go
Date: March 3, 2005 at 07:34:21 Pacific
Reply:

Hi vicky,

This has some rough edges. I'm at a bit of a disadvantage, because I don't know what your program does. So I used COPY just to see if it tossed the right file names.

Maybe you can figure out the rest.

Notice that the first two lines are there to generate some files for testing.

::**
for %%n in (ONE TWO THREE) do echo %%n > %%n.akm
for %%n in (ONE TWO THREE) do echo X%%n > %%n.xml

for %%A in (*.*) do if %%~xA==.akm call :MP2XML %%A

goto :eof

:MP2XML

for %%B in (*.xml) do copy %1+%%B %~n1.new

:eof
::**

HTH


M2


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Event Viewer script c var precision problem (...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: consecutive loops in batch file

help needed with loop in batch file www.computing.net/answers/programming/help-needed-with-loop-in-batch-file/16897.html

Nested loop in batch file help www.computing.net/answers/programming/nested-loop-in-batch-file-help/19396.html

Date Routines in Batch Files www.computing.net/answers/programming/date-routines-in-batch-files/15590.html