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

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 in DOS

Reply to Message Icon

Name: bengalliboy
Date: March 3, 2005 at 07:43:36 Pacific
OS: win2k
CPU/Ram: 1gb
Comment:

I want a prmpt in a batch file before runing. The logic is simple some thing like this:
@echo off
echo "Do you want to run the program?"
REM Needs Input (Y/N)
if (Input) = Y/y then
Goto Proceed
else
Exit
Can some one please help? Thanks




Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: March 3, 2005 at 08:05:43 Pacific
Reply:

To solve your question is easy, but...

the solution is different under DOS kernel and NT systems as Windows 2K is. So as you declare to run Win 2K post in the right forum otherwise DOS guys may be offended.


0

Response Number 2
Name: bengalliboy
Date: March 3, 2005 at 08:15:36 Pacific
Reply:

If it is easy why don't you post the answer please? I tried to post it on Win2k fprum and it does not let me... saying I can post only in one place... Can any one please help?


0

Response Number 3
Name: Mechanix2Go
Date: March 3, 2005 at 08:33:39 Pacific
Reply:

Try this:

::**
@echo off > quit.bat
choice Do you want to proceed?
if errorlevel 2 quit

your prog
::**

Works for most flavors.

***
Hi IVO,

DOS guys get offended?

Well, who'd athought it.
**
Every time I get a need for 'tokens' or whatever I dig out one of the scripts of yours which I saved. I still can't get it through my thick head.


M2


0

Response Number 4
Name: bengalliboy
Date: March 3, 2005 at 08:53:06 Pacific
Reply:

Thank Mechanix2go, but my DOS does not like "Choice" Command... any thing else I can try?
TIA


0

Response Number 5
Name: dtech10
Date: March 3, 2005 at 08:54:45 Pacific
Reply:

Hi Aftab
As IVO says there are some people who don't like you posting winXP/2000 questions. as the DOS Prompt in these operating systems is simulated MSDOS and not what can be called Real Mode MSDOS.

But to help you for now try this.

@echo off
set /p Input=
if /i "%Input%"=="y" (goto Proceed)
exit /b
:Proceed
echo Proceed

or this

if /i not "%Input%"=="y" (exit /b)
rem Here if Input=y/Y
echo Proceed


-1

Related Posts

See More



Response Number 6
Name: IVO
Date: March 3, 2005 at 09:01:15 Pacific
Reply:

Hi Mechanix2Go,

thank you for your words, you look a kind and practical person, but people in this Forum seems to hate NT related (although loosely) questions.

I do not agree with Fundamentalists (wherever they are), but I respect the dominant opinions too. That explains my previous post.


0

Response Number 7
Name: bengalliboy
Date: March 3, 2005 at 09:04:24 Pacific
Reply:

Dtech10, Thank you so much!! It worked.


0

Response Number 8
Name: jboy
Date: March 3, 2005 at 09:12:28 Pacific
Reply:

Like so many things in life, it helps if you read the instructions. Those are pretty prominently located at the top of the forum page

It's not so much a matter of 'offending' anyone, it is a matter of site policy - and we've covered this ground before.

If you can answer the post - fine, no need to do a song & dance routine - but in reality Win2K questions should be posted in the Win2k forum (go figure) not in DOS, or Linux, or BeOS.

It's not that complicated.

You are here


0

Response Number 9
Name: Mechanix2Go
Date: March 3, 2005 at 09:19:57 Pacific
Reply:

Aftab,

Which DOS does not like 'choice' and what does it not like about it?

***
IVO,

Yeah, good to get in sync with the crowd.

I'd rather try to help than pass out earaches.

Since set /p [or if /i] is working, as offered by dtech10, it apparently is NOT DOS.

AFAIK, 'choice has been included in every DOS and winders EXCEPT w2k.

So I guess he's using w2k cmd.exe


M2


0

Response Number 10
Name: dtech10
Date: March 3, 2005 at 14:33:14 Pacific
Reply:

Hi
Maybe there should be a sub-section called "WinXP/W2k Command Prompt" as this is what Mr Gates calls it in Windows.
Then maybe that wouldnt work either.


0

Response Number 11
Name: jboy
Date: March 3, 2005 at 14:57:28 Pacific
Reply:

That has been suggested - for now we're trying to work with the newly named 'DOS Standalone' Forum and the fairly explicit instructions at the top of the page.

Bottom line is, it's a help forum - posts won't be removed if they can be answered, although it is in the OP's best interest to post in the appropriate forum.

Contributers in this forum shouldn't be expected to be knowledgeable in every command line interface going.

You are here


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 in DOS

DOS Batch - Accepting User input to system Variable www.computing.net/answers/dos/dos-batch-accepting-user-input-to-system-variable/658.html

3 things a user does in Dos but not GUI www.computing.net/answers/dos/3-things-a-user-does-in-dos-but-not-gui/10072.html

user input www.computing.net/answers/dos/user-input/9020.html