Last month's article finished up with an unexplained example of the FOR command which read as follows:
I have been asked by a number of users just what it was and what use it is. I don't propose to delve into the obscure depths of DOS. It's spooky down there. However I will explain how to use this very powerful command. Have you ever accidentally copied a floppy into your hard disk? A hard disk that already had a bundle of useful files in it thus making DEL *.* too painful to get rid of the unwanted ones. I think we all have at some time. Now you could load Xtree or Norton's Commander, tag the offending files and delete them. That's one way. A simpler way would be to log on to drive A: with the original disk in that drive and issue the above command. You would have to modify the C:\%x to reflect the appropriate subdirectory. What this command does is to load whatever is enclosed in the brackets into the %x (it could be % any letter) one at a time and execute the command following the DO using the %x.
This means that it would read all the filenames in drive A: and delete any file with the same name in drive C: (or where ever). You can put anything between the brackets. For example, I use it to copy all my frequently used DOS files, utilities and batch files into a RAM disk which is the first item in my PATH. I do it in my AUTOEXEC.BAT. It tweaks a bit more performance from my XT. That part of the AUTOEXEC.BAT looks like this
Note the double % signs when used inside a batch file. (DOS throws the first one away). I can add or delete files by modifying what appears inside the brackets. As you get used to it you can do all kinds of interesting things but enough is
enough - we don't want you blowing your fuses yet. |