A few simple batch questions

This is a discussion on A few simple batch questions within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Since SET can also be used from the DOS prompt, would it work if I used it in a batch ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    A few simple batch questions

    • 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?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Answers:
    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:
    http://www.google.com/search?q=dos%2...utf-8&oe=utf-8
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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.
    Last edited by sean; 07-01-2003 at 08:37 PM.

  4. #4
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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.

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Another one to consider:
    http://sourceforge.net/projects/regina-rexx/
    An implementation of the the ANSI Standard REXX Programming Language, available for most operating systems
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 09:47 AM
  2. Simple Socialising Chat Bots
    By bengreenwood in forum C++ Programming
    Replies: 10
    Last Post: 11-28-2007, 08:42 AM
  3. Two simple questions.
    By Queatrix in forum Windows Programming
    Replies: 10
    Last Post: 10-09-2005, 06:10 PM
  4. A couple questions
    By Flakster in forum C++ Programming
    Replies: 7
    Last Post: 08-09-2005, 02:22 PM
  5. Few simple questions...
    By Shane in forum C++ Programming
    Replies: 9
    Last Post: 08-06-2005, 03:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21