Computing.Net > Forums > Disk Operating System > User Input

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

User Input

Reply to Message Icon

Name: pipipo
Date: February 25, 2008 at 18:58:51 Pacific
OS: XP
CPU/Ram: not sure
Product: IBM
Comment:

Hi all,
i am given a task to write a batch file that will allow user to put in input(maybe just Y/N) and it will act accordingly.
IF their input is Y then it will open one excel file n one word file and if the input is N den it will juz shut the program..
anyone about to help?
thanks lots



Sponsored Link
Ads by Google

Response Number 1
Name: cup
Date: February 26, 2008 at 13:15:14 Pacific
Reply:

set /p reply=y or n
if "%reply%" == "n" goto eof
.. do something


0

Response Number 2
Name: pipipo
Date: February 26, 2008 at 17:41:35 Pacific
Reply:

thank you so much.
now i know tat i have to add % infront to make it work. i tried the if statement so many time and nothing happen


0

Response Number 3
Name: alexanrs
Date: February 26, 2008 at 17:50:06 Pacific
Reply:

Does that work on DOS?!
Last time I checked, on DOS (and Win9x) you have to use CHOICE.EXE, that comes with the OS but doesn't seem to be present in NT/2K/XP.
In real DOS, that should be:

CHOICE /C:YN "question"
IF ERRORLEVEL 1 GOTO END
... do what you have to do here ....
:END


0

Response Number 4
Name: pipipo
Date: February 26, 2008 at 19:18:44 Pacific
Reply:

it works for my case.
im using XP


0

Response Number 5
Name: Mechanix2Go
Date: February 27, 2008 at 01:31:25 Pacific
Reply:

Seems like CHOICE got left out of w2k; I use w9x CHOICE.

#3, the errorlevel will always be 1 or more.


=====================================
If at first you don't succeed, you're about average.

M2



0

Related Posts

See More



Response Number 6
Name: alexanrs
Date: February 27, 2008 at 07:42:43 Pacific
Reply:

Opps, my bad.

IF ERRORLEVEL 1 GOTO END

should be

IF ERRORLEVEL 2 GOTO END

Anyway, pipipo, keep this in mind in case you ever need to use your batch file in older Win9x-based systems.


0

Response Number 7
Name: cup
Date: February 27, 2008 at 12:04:44 Pacific
Reply:

It is choice for DOS, 9x, ME family and set for NT, 2K, XP, Vista family.

You can also run some Norton batch commands that will do something similar in DOS.

I don't know about freedos.


0

Response Number 8
Name: IVO
Date: February 28, 2008 at 14:09:26 Pacific
Reply:

FreeDOS offers both set /p as Win NT/2K/XP and choice as Win 9X/ME - DOS/Win 3X.

Choice is not standard for XP editions and has to be added from SDK package.


0

Response Number 9
Name: alexanrs
Date: February 28, 2008 at 14:34:27 Pacific
Reply:

Actually, you can just copy the CHOICE.exe from a Win9x/FreeDos setup.


0

Response Number 10
Name: Dan Penny
Date: February 28, 2008 at 14:58:14 Pacific
Reply:

"im using XP"

ISN'T THIS THE DOS FORUM!!!!!!

(Just kidding.... Shades of "You_Know"....)

Ah, the memories.....

(Sorry, I have time on my hands today..)

It's a good day when you learn something


0

Response Number 11
Name: Mechanix2Go
Date: February 28, 2008 at 19:09:45 Pacific
Reply:

Hi Dan


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 12
Name: Dan Penny
Date: February 28, 2008 at 20:58:20 Pacific
Reply:

Hi M2G


It's a good day when you learn something


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: User Input

user input unsolved www.computing.net/answers/dos/user-input-unsolved/3992.html

The ULTIMATE method to get user input !! www.computing.net/answers/dos/the-ultimate-method-to-get-user-input-/8711.html

Interactive batch files w/user input www.computing.net/answers/dos/interactive-batch-files-wuser-input/3274.html