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

Author Topic: Help with .bat file  (Read 3855 times)

0 Members and 1 Guest are viewing this topic.

Alexander

  • Guest
Help with .bat file
« on: November 08, 2004, 03:00:33 AM »
Hi, I wolud like to create a bat file that does different things according to user inputs.
I am using the "CHOICE" cmd but canīt get it to work.
This is what it looks like:

@echo Choose country, specify with digit:
@echo 1 England
@echo 2 France
@echo 3 Italy
@echo 4 Switzerland
@echo 5 Germany
@echo 6 Austria
CHOICE [1,2,3,4,5,6] "Choose one"
...
What happens when I run the file is it does not wait for the user to input a digit, it just finishes, what am I doing wrong?

Dusty



    Egghead

  • I could if she would, but she won't so I don't.
  • Thanked: 75
  • Experience: Beginner
  • OS: Windows XP
Re: Help with .bat file
« Reply #1 on: November 08, 2004, 03:06:43 PM »
Read here: http://www.computerhope.com/batch.htm#1

See the Choice section
One good deed is worth more than a year of good intentions.

Alexander

  • Guest
Re: Help with .bat file
« Reply #2 on: November 10, 2004, 12:09:41 AM »
Hi, I already looked at that site, it did not help much. I am using NT4 and so the choice cmd does not work. What I want to do is, depending on user input start a telnet seesion, wait for that to  end and then let the user choose again and then start a new telnet session. In pseudo code it should look someting like this:

Echo Choose one destination:
1. Soccer
2. Basketball
3. Baseball

If usrinput = 1 then GOTO Label 1
If usrinput = 2 then GOTO Label 2
If usrinput = 3 then GOTO Label 3

label1: telnet 192.192.192.10
label2: telnet 192.192.192.10
label3: telnet 192.192.192.10

..wait for telnet session to be ended..

Userinput, choose again ..
1. Soccer
2. Basketball
3. Baseball

If usrinput = 1 then GOTO Label 1
If usrinput = 2 then GOTO Label 2
If usrinput = 3 then GOTO Label 3

label1: telnet 192.192.192.10
label2: telnet 192.192.192.10
label3: telnet 192.192.192.10
end!

Can this be done within a .bat file?
I appriciate all help I can get, thanks on forehand..
//Alex

MalikTous

  • Guest
Re: Help with .bat file
« Reply #3 on: November 10, 2004, 05:13:13 AM »
I'm not sure if unmodified NT can handle this. You may have to use a CMD extension like JP Software's 4NT (like 4DOS...). This command line shell provides extended handling and support of command-shell programming.

Alexander

  • Guest
Re: Help with .bat file
« Reply #4 on: November 11, 2004, 01:14:40 AM »
Ok, thanks for your answer, could you perhaps post a relevant link to the software you are referring to?
Where you can download it and so on..

Thansk again

/Alex


2k dummy

  • Guest
Re: Help with .bat file
« Reply #5 on: November 11, 2004, 09:00:20 AM »
Just put a copy choice.com on the machine. It will work with NT. It doesn't come with NT but is an add-on. It is also available on any win9x cd. Remember the KISS principle. ;D

KISS: Keep It Simple Stupid

franksimari

  • Guest
Re: Help with .bat file
« Reply #6 on: November 16, 2004, 02:09:52 PM »
there is a simple but extremely workable way if you know what files you want the user to use... and you need to know the path.

first make a simple menu.scr using an edit program

something like this:
 
                      a             run edit
                      b             run notepad
                      c              exit

then you need to make a batch file called menu.bat

                  it will say    
                         echo off
                         cls
                  type menu.scr


then you make    a.bat    which simply says
                            notepad


then you  make b.bat which simply says
                             edit

of course, the path  needs to be included for programs which are not in your DOS path