1.

Solve : For token(I think)...?

Answer»

I'm very new to the whole FOR command, everything in the help just blows me away...

I'm trying to help my friend out by using DOS, and he has asked me to do something completely out of my knowlage.

With the FOR command, I've seen people set a variable as a section of text, using spaces or commas as delimiters(I hope I spelled that right)...What I need to do is:
1. Set a variable for each line of text. (Eg %L1% %L2% etc.)
2. If there are more than 30 lines, delete the FIRST line every time a new one is added (refresh every 2 seconds using ping and goto)


If possible, share a code, and help me understand how the code works, so in the future I won't have to ask again.

Thanks in advance!Well I will be the first to say something. But no way can I be last. I have used DOS for more years that I care to admit. I still do not understand the FOR command. It is really a LOOP structure, but called it FOR instead.

Anyway, here on this site there is a rather long explanation of how it works.

FOR %variable IN (set) DO command [command-parameters]

What you need to know is that variable is a single letter with the % in front of it. Inside a batch file it has TWO of them thar tingabops. Each time through the loop, the variable with have a another value. It is TAKE from the list of names found by the SET whatcha ma callit. Lets say you used joy*.HTM thne you would have a list of all HTM files thatstart with the letters J O Y in the current FOLDER. The DO command then does something for every files that was in the list. But not needing to modify each file in the list. Just do something. Like count, beep, waste time, show a message. Whatever.
Batch files are batch files. Which means the do not pay attention to external events,not can the over ride external things. The batch file has its own world. It can not modify a file somebody else is using. The batch file can modify things only when nobody else is doing something with them. This is one big DRAWBACK of using DOS in a GUI (Windows) system.
Now then, are you sure that the FOR command will do what you want?
I mean, is it more important to understand the FOR command, or is it m,ore important to do a certain thing that improves the computer presentation.
Quote from: Geek-9pm on January 13, 2009, 03:54:36 PM

I mean, is it more important to understand the FOR command, or is it m,ore important to do a certain thing that improves the computer presentation.


Priority:
1. Getting the job done
2. Understanding it more, so I won't be so dependant.

I promised my friend that I would do it, but as I said in the first post, I just don't know.


Discussion

No Comment Found