Computing.Net > Forums > Programming > FOR loop

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.

FOR loop

Reply to Message Icon

Name: Podde
Date: May 3, 2009 at 16:21:18 Pacific
OS: DOS 7.10
CPU/Ram: 2,6DC/4096
Subcategory: Batch
Comment:

Is there anyone who knows how to create a FOR loop in a batch-file? I have a textfile with some text and driveletters like A: B:....but it could as well be A: P: Z:.

How do I search in the txt-file and passes the result to a variable. If possibile each hit would end up as %CD1%, %CD2%....

I´ll guess that DOS 7.10 does not have the best FOR support, so the second best could be that the variable %CD% is for all "hits" so the result is A:,B:.

Thanks for any answer.



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: May 4, 2009 at 02:22:00 Pacific
Reply:

Sorry, but DOS 7.10 (from Windows 98) doesn't support advanced FOR statements as you can issue under NT kernel Windows (NT/2K/XP/Vista).

Under DOS kernel a batch can't access the content of a text file as For /F can do. So there is no way to achieve that using plain DOS batch.


0

Response Number 2
Name: Podde
Date: May 4, 2009 at 13:03:15 Pacific
Reply:

Thanks for the answer. Guess I have to use the find command and the errorlevel given. Makes the batch longer but not a very big deal. Again thanks. //P


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







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: FOR loop

Batch FOR Loop %ERRORLEVEL% www.computing.net/answers/programming/batch-for-loop-errorlevel/13528.html

Batch file FOR LOOP www.computing.net/answers/programming/batch-file-for-loop/11504.html

using for loops to interate unicode www.computing.net/answers/programming/using-for-loops-to-interate-unicode/12858.html