CMD help please!

  • kerbal1234
    17th Jun 2011 Member 0 Permalink
    i really am having trouble with CMD... so, my problem is i made a program, not too exiting, tells a story that's it. but it has no delay, so i open it, BAM! it autocloses in 0.5 secs. also, if anybody knows how to make CMD wait until the command is needed, (example: MSG * Hello! (DELAY UNTIL CLICK OR SOME SORT OF AUTHORIZATION) or just how to make a delay in between commands, please show and tell how. Thanks!
  • JH-Darkfire
    17th Jun 2011 Member 0 Permalink
    Try this:

    @echo off
    cls
    color 0a
    Echo Hello!
    pause
    Echo How was your day?
    pause

    It makes it stop until you hit a key.

    Add the "pause" command every time you want it to stop. It stops until a key is pressed.

    Anything else? (I am the man at CMD)
    Edited by JH-Darkfire, 2011-06-16 02:27:37
  • kerbal1234
    17th Jun 2011 Member 0 Permalink
    i got this done. i found the delay i wanted. Thanks for pause though. it helped alot.
  • Cr15py
    17th Jun 2011 Member 0 Permalink
    @kerbal1234 (View Post)
    I know this problem isn't what you're looking for, but I seriously suggest you try learning a scripting language like Python, Perl, LUA, etc. It will give you a lot more functionality and actual programming experience.
    If you do, find a good, detailed tutorial, and READ IT ALL. Once your over that first road block of confusion it will be simply learning functions/syntax. Always experiment when learning a new language too.
    For batch scripting, pause is your only real way, like I said, batch is extremely limited.
  • The-Con
    17th Jun 2011 Member 0 Permalink
    @kerbal1234 (View Post)
    An easy delay is
    ping localhost -n # > nul

    e.g.

    @echo off
    :a
    cls
    echo how are you today?
    echo.
    ping localhost -n 3 > nul
    goto b

    :b
    cls
    echo The delay works!
    pause
    goto a

    Or you could have a pause after ping localhost
    e.g.
    echo Hello
    ping localhost -n 3 > nul
    pause

    Edit:
    But I agree with Cr15py. CMD coding/ batch is very simple... (its not always batch)
    Edited by The-Con, 2011-06-16 08:21:36
  • jalfor
    17th Jun 2011 Member 0 Permalink
    @kerbal1234 (View Post)
    I don't mean to just repeat what everyone else just said though batch isn't really the best choice for doing things like that. It's good for some things though that is one thing it most certainly is not.
  • The-Con
    17th Jun 2011 Member 0 Permalink
    Indeed. The only reason I use batch is to make adventure rpg games (text based) or tycoon games. Its really easy, so its something I do on a day I don't want to think... about 98% of the year.

    EDIT: I also make programs so that I can easily access different folders and programs without navigating.
    Edited by The-Con, 2011-06-16 09:38:41
  • mniip
    17th Jun 2011 Developer 0 Permalink
    @echo off
    :begin
    set h=hello
    set /p str "Say %h%"
    if %str%=%h% goto ok
    echo u didnt say %h%, u said %str%
    goto begin
    :ok
    echo thanx
    pause
  • kerbal1234
    17th Jun 2011 Member 0 Permalink
    yeah, i have python but i have no clue how to use it.
    P.S do you know a display text command?
    Edited by kerbal1234, 2011-06-17 23:20:00
  • MasterMind555
    17th Jun 2011 Member 0 Permalink
    @kerbal1234 (View Post)
    Learn C#
    100 Times more Awsome Sauce in the same Quantity