Computer Hope
Microsoft => Microsoft DOS => Topic started by: Alexander 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?
-
Read here: http://www.computerhope.com/batch.htm#1
See the Choice section
-
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
-
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.
-
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
-
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
-
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