Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: User Input

Original Message
Name: pipipo
Date: February 25, 2008 at 18:58:51 Pacific
Subject: User Input
OS: XP
CPU/Ram: not sure
Model/Manufacturer: 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


Report Offensive Message For Removal

Response Number 1
Name: cup
Date: February 26, 2008 at 13:15:14 Pacific
Subject: User Input
Reply: (edit)
set /p reply=y or n
if "%reply%" == "n" goto eof
.. do something

Report Offensive Follow Up For Removal

Response Number 2
Name: pipipo
Date: February 26, 2008 at 17:41:35 Pacific
Subject: User Input
Reply: (edit)
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

Report Offensive Follow Up For Removal

Response Number 3
Name: alexanrs
Date: February 26, 2008 at 17:50:06 Pacific
Subject: User Input
Reply: (edit)
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


Report Offensive Follow Up For Removal

Response Number 4
Name: pipipo
Date: February 26, 2008 at 19:18:44 Pacific
Subject: User Input
Reply: (edit)
it works for my case.
im using XP

Report Offensive Follow Up For Removal

Response Number 5
Name: Mechanix2Go
Date: February 27, 2008 at 01:31:25 Pacific
Subject: User Input
Reply: (edit)
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



Report Offensive Follow Up For Removal

Response Number 6
Name: alexanrs
Date: February 27, 2008 at 07:42:43 Pacific
Subject: User Input
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 7
Name: cup
Date: February 27, 2008 at 12:04:44 Pacific
Subject: User Input
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 8
Name: IVO
Date: February 28, 2008 at 14:09:26 Pacific
Subject: User Input
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 9
Name: alexanrs
Date: February 28, 2008 at 14:34:27 Pacific
Subject: User Input
Reply: (edit)
Actually, you can just copy the CHOICE.EXE from a Win9x/FreeDos setup.

Report Offensive Follow Up For Removal

Response Number 10
Name: Dan Penny
Date: February 28, 2008 at 14:58:14 Pacific
Subject: User Input
Reply: (edit)
"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


Report Offensive Follow Up For Removal

Response Number 11
Name: Mechanix2Go
Date: February 28, 2008 at 19:09:45 Pacific
Subject: User Input
Reply: (edit)
Hi Dan


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

M2



Report Offensive Follow Up For Removal

Response Number 12
Name: Dan Penny
Date: February 28, 2008 at 20:58:20 Pacific
Subject: User Input
Reply: (edit)
Hi M2G


It's a good day when you learn something


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: User Input

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC