Woofy613 Topic Starter
Posts: 8
|
 |
« on: September 14, 2008, 09:17:12 PM » |
|
I wish to do the following, which I am writing in pseudo code.
What I wish to be able to do is to run a program, reading from sequential data files [name%1]. I wish to increment the calculation until the last data file [name%3] is reached. I also will be calling other batch flies to rename or copy the original output. The range of %1 can be from 1 to 200 [or larger]
I am a newbie, so please excuse me...
The command line is: batchfile %1 %2 %3
The batch file is:
:start if %1 is greater than %3 goto end program1 %1 %2 call prog1 %1 %2 call prog2 %1 %2
increment %1 by one go to start
:end exit
|
|
|
|
|
devcom
Thanked: 37 Posts: 521
|
 |
« Reply #1 on: September 15, 2008, 06:57:25 AM » |
|
set var=%1
:LOOP if '%1' gtr '%3' goto :EOF program1 %var% %2 call prog1 %var% %2 call prog2 %var% %2
set /a var+=1 goto LOOP
|
|
|
|
Woofy613 Topic Starter
Posts: 8
|
 |
« Reply #2 on: September 15, 2008, 10:40:41 PM » |
|
Thanks.
Some problems:
1] I get a syntax error in this line: if '%1' gtr '%3' goto :EOF 2] var never increments
Advice please.
Thanks again.
|
|
|
|
|
Dias de verano Guest
|
 |
« Reply #3 on: September 16, 2008, 12:14:01 AM » |
|
@echo off set /a var=%1 :LOOP if %var% gtr %3 goto :END program1 %var% %2 call prog1 %var% %2 call prog2 %var% %2 set /a var+=1 goto LOOP :END
|
|
|
|
|
Woofy613 Topic Starter
Posts: 8
|
 |
« Reply #4 on: September 16, 2008, 06:33:03 AM » |
|
Thanks.
I have the same problems, even with the edits suggested.
1] No matter how I try to edit this line, I get syntax errors if %var% gtr %3 goto :END
2] var never increments
Thanks again.
|
|
|
|
|
devcom
Thanked: 37 Posts: 521
|
 |
« Reply #5 on: September 16, 2008, 06:47:14 AM » |
|
are you know how to use %1 %2 and %3 ??
|
|
|
|
Dias de verano Guest
|
 |
« Reply #6 on: September 16, 2008, 10:14:10 AM » |
|
are you know how to use %1 %2 and %3 ??
That is what I am wondering. There is a strong smell of homework around this thread.
|
|
|
|
|
Jacob
Posts: 338
|
 |
« Reply #7 on: September 16, 2008, 10:49:40 AM » |
|
are you know how to use %1 %2 and %3 ??
That is what I am wondering. There is a strong smell of homework around this thread.
dun dun dun. 
|
|
|
|
Woofy613 Topic Starter
Posts: 8
|
 |
« Reply #8 on: September 16, 2008, 05:45:15 PM » |
|
OS Win2000 SP4
The file is test.bat
command line: test 1 3
file:
echo on set /a var=%1 :LOOP IF %var% GTR %2 GOTO :end echo that's it set /a var+=1 goto loop :end echo end it exit
error message
IF GTR 3 GOTO :end
syntax error.
Where have I made my mistake??
|
|
|
|
|
Woofy613 Topic Starter
Posts: 8
|
 |
« Reply #9 on: September 16, 2008, 08:49:26 PM » |
|
One correction:
My OS is DOS 7.1, the last pure DOS from Microsoft. It is the one that comes with Windows 98. My machine runs ONLY this DOS. There is no Windows on the box.
|
|
|
|
|
Dias de verano Guest
|
 |
« Reply #10 on: September 17, 2008, 12:01:53 AM » |
|
You don't get set /a with genuine MS-DOS. Only NT4 and later members of NT family. That's why you're getting the error.
|
|
|
|
|
Woofy613 Topic Starter
Posts: 8
|
 |
« Reply #11 on: September 17, 2008, 07:49:30 AM » |
|
Thank you.
Is there anything I can do to make it work, possibly different code in the batch file?
|
|
|
|
|
Dias de verano Guest
|
 |
« Reply #12 on: September 17, 2008, 11:06:40 AM » |
|
Time to start learning QBasic.
|
|
|
|
|
Woofy613 Topic Starter
Posts: 8
|
 |
« Reply #13 on: September 17, 2008, 01:21:31 PM » |
|
Thank you for all your excellent help.
I would not like to be forced to learn another language now. I have 100 massive data files to analyze and I would like to be able to loop thru them w/o having to baby sit the computer.
Is there any work around? I would assume that people programming in pure DOS have had this problem and found a solution.
Thanks again.
|
|
|
|
|
Dias de verano Guest
|
 |
« Reply #14 on: September 17, 2008, 01:27:52 PM » |
|
In general, people have moved on from "programming in pure DOS" as you call it. When it was the only game in town, many people did learn QBasic, for precisely the reasons you are finding.
|
|
|
|
|