Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: An odd question  (Read 2786 times)

0 Members and 1 Guest are viewing this topic.

DOSNEWB

    Topic Starter


    Starter

    An odd question
    « on: November 12, 2008, 02:52:19 PM »
    Hey guys, as the title says I have an odd if not confusing question for you all.

    I'm writing a .bat file for a friend that wants to screw with another friend for his birthday (I know...we're nerds XD)

    But I want the computer to spit out one line of txt if I put one phrase into command prompt and something completly different if I put another thing into command prompt.

    How do I specify what I want it to say?? I'm gonna just bs the actual codes but im wanting it to say something like:

    if (response)=="morning" goto B
    if (response)=="Afternoon" goto C
    :B
    echo Good Morning
    :C
    echo Good Afternoon


    i dunno if I explained it well enough but its the best I can do without attaching the actual files and stuff

    macdad-



      Expert

      Thanked: 40
      Re: An odd question
      « Reply #1 on: November 12, 2008, 04:35:42 PM »
      Code: [Select]
      @echo off
      set /p response=
      if /I '%response%'=='morning' goto B
      if /I '%response%'=='Afternoon' goto C
      :B
      echo Good Morning
      pause
      exit

      :C
      echo Good Afternoon
      pause
      exit

      try that
      If you dont know DOS, you dont know Windows...

      Thats why Bill Gates created the Windows NT Family.

      DOSNEWB

        Topic Starter


        Starter

        Re: An odd question
        « Reply #2 on: November 13, 2008, 07:17:35 PM »
        okay, thanks, can I use 'response' and ' if /I ' through out the whole thing or do I have to change it up each time?

        DOSNEWB

          Topic Starter


          Starter

          Re: An odd question
          « Reply #3 on: November 14, 2008, 09:02:16 PM »
          or is there any way that I can set it so that if 'response' doesn't equal any of the above, to display something? would I just seperate them with commas or what?

          Dusty



            Egghead

          • I could if she would, but she won't so I don't.
          • Thanked: 75
          • Experience: Beginner
          • OS: Windows XP
          Re: An odd question
          « Reply #4 on: November 14, 2008, 11:52:37 PM »
          http://www.computerhope.com/forum/index.php/topic,58736.0.html

          Please read the section Causing users grief / hacking

          What you want to do seems to be in breach of the rules.  If you disagree with the rules please contact CH Admin.

          One good deed is worth more than a year of good intentions.