Results 1 to 1 of 1
2002-03-31, 21:55 #1
- Join Date
- Feb 2001
- Yilgarn region of Toronto, Ontario
- Thanked 0 Times in 0 Posts
A Different kind of Easter Bunny:
OK. Here's a Batch job that just refuses to give up. A self perpetuating batch job.
Scenario: You need to run a lengthy task on a set of 10 partitions
But you don't want to run them all at once.
You figure that if you could asemble a list of drives
(C D E F G H I J K L)
and pass them to a batch job, then you'd be happy
if the batch job would do its thing on the first drive in the list
and set itself up to do the next drive next time.
Paste this code into a batch job called "98DoScan.bat".
<pre>REM 98DoScan.bat Christopher Greaves Sunday, March 31, 2002
:: Self-perpetuating batch job
:: Preserve parameter 0 before we SHIFT it off the edge of the planet
:: Now perform the task.
:: Here we just echo and visually note the first parameter.
:: A practical example would include a ScanDisk or similar task
@echo Doing %1 %2 %3 %4 %5 %6 %7 %8 %9
:: The job is done. Now set it up for the next pass
echo %MyName% %1 %2 %3 %4 %5 %6 %7 %8 %9 %0 > 98DoAgin.bat
Initialise the rest of your life by issuing the command:
<pre>98DoScan C D E F G H I J K L
Note that the echo has as its first issue the letter "C"
This corresponds to running ScanDisk on drive C:
Now issue the command 98DoAgin
Note that the echo has as its first issue the letter "D"
This corresponds to running ScanDisk on drive D:
Issue the command 98DoAgin repeatedly, and note that the echo cycles through each letter of the sequence.
Les'see: Five working days a week, you should be scanning drive C again a fortnight from now.
I leave it as an exercise for the reader to modify the batch job so that a Scandisk takes place on drive C, followed the next call by a Defrag on drive C, then Scandisk D:, Defrag D:, Scandisk E: etc.