View Full Version : A few simple batch questions

07-01-2003, 06:14 PM
Since SET can also be used from the DOS prompt, would it work if I used it in a batch file under XP?
I couldn't find a good internet tutorial on the subject. How do I access the information given to my script as parameters in the command-line?
Is there a way to do arrays in batch files? I mean aside from having a bunch of variables like VAR1, VAR2, etc...
Again, no good tutorial; are there any naming conventions for batch? Are you required to have a %, and can you do any variable processing, like arithemtic, for example?

07-01-2003, 06:43 PM
1) - Yes

2) %1 is the first arg, then %2 etc

3) Dunno.

4) Arithmatic: Probably, but I can't remember. Anything in these of interest:

07-01-2003, 07:26 PM
Well thanks for the first two. I've searched all over search engines, but not the exact wording you used, so I'll try that. Thanks again, and anyone else? If needs be, I can make some compiled programs for the arithmetic, but since they'd need to be easily changeable without a compiler, it's not much better than nothing at all.

edit: Well I checked out some of those sites, and it just so happens that arithmetic IS possible. So they say. Basically you have to create a bunch of tables, and it does some movement through the array to find the right number. The example they use would mean I would have to double the size of my script, and it would only be able add and subtract the numbers 0 - 9. I'd then have to set up control structures to modify this into multiplication and very limited division. Somehow I'm supposed to turn this into an algorithm that searches massive arrays of data for any sign of a pattern? I don't think so. Let's see what the windows guys can do about this. Thanks anyway.

07-02-2003, 10:50 AM
Thanks Salem. I would use Perl, and all the other scripting options for windows, but the idea behind using batch was so that it could be used by anyone, independently without having to install dependent software. I'm using Perl for one of the CGI versions of my program, but I did some thinking about using Windows (C++ of course), and I realized the program would be 10 times better if it ran as a background program like instant messengers or something. It would be much faster, easier, and probably more effective. I'll probably be working with DavidP on this, since I have no interest in learning Windows programming, but I'm still waiting to hear back from him.

07-02-2003, 01:35 PM
Another one to consider:

An implementation of the the ANSI Standard REXX Programming Language, available for most operating systems