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
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 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
Summary: Here is the code: for /f %%Q in (machines.txt) do ( ping -n 1 -w 3 %PingThis% IF %ERRORLEVEL% == 0 echo %%Q >> alive.txt ELSE echo %%Q Failed Ping >> dead.txt ) Now, the problem is this. In machines....
Summary: Hi, I need to run a particular se of commands repetatively for some number of times provided by userin for loop. I am doing it this way user input the no of arguments and arguments i.e 3 d:\\input.txt...
Summary: k im new and i just want to make a program that uses for loops to somehow interate and print out every unicode symbol from 0001 to 9999. basically all i can come up with is I would need to use: publi...