batch files

This is a discussion on batch files within the Tech Board forums, part of the Community Boards category; Aside from this being a bit of n00bish question, it is as you may have guessed, a batch problem. Either ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    6

    batch files

    Aside from this being a bit of n00bish question, it is as you may have guessed, a batch problem. Either I don't know enough, or I don't the syntax. When I write a file and compile it into a .bat file, it does open and stay in place, but when I press enter it closes. It is supposed to ask a question. I put in an if statement. So basically it asks your age, and if it's less than 18 it says "not old enough" or something like it. But when I type in a number and press enter, it closes the window. Is it supposed to do that? Couldn't find it in any of my books so I turned to these forums.

    Enter your age:

  2. #2
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    1. This isn't really the appropriate place for this question.
    2. You don't compile batch files. They are interpretted.
    3. (I assume you are using Windows) Either run it from command line or put "Pause" as the last command.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,636
    Moved to Tech Board.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Nov 2008
    Posts
    6
    Quote Originally Posted by NeonBlack View Post
    1. This isn't really the appropriate place for this question.
    2. You don't compile batch files. They are interpretted.
    3. (I assume you are using Windows) Either run it from command line or put "Pause" as the last command.
    But that was in C

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    once the bat file finished the DOS box closes, this is normal behavior, if you wan ti tto wait then you need to add a PAUSE
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  6. #6
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Sm33zy View Post
    But that was in C
    Hence the reason why it didn't belong in the C Programming section - since it has nothing to do with C.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 07-24-2008, 09:02 AM
  2. Windows Vista Batch Files
    By Trennto in forum Windows Programming
    Replies: 2
    Last Post: 07-02-2008, 09:30 AM
  3. Program Deployment and DLL/OCX Files?
    By dfghjk in forum C++ Programming
    Replies: 5
    Last Post: 06-16-2008, 02:47 AM
  4. help running batch files
    By xxwerdxx in forum Tech Board
    Replies: 5
    Last Post: 09-25-2005, 12:58 PM
  5. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM

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