Computing.Net > Forums > Windows 2000 > Reading input from a batch file

Reading input from a batch file

Reply to Message Icon

Original Message
Name: Sumanth Sharma
Date: September 9, 2003 at 21:32:04 Pacific
Subject: Reading input from a batch file
OS: Windows 2000 Professional
CPU/Ram: P IV 2.4GHz / 512MB
Comment:

How do I input a value using a batch file.

For example, In perl i would say

$input = ;
similairly in a unix shell scrips I will say

read input;

MY QUESTION IS HOW TO ACHIEVE THIS IN MS-DOS
BATCH FILE?

HOPE TO GET SOMETHING FROM U'R EXPERTISE.


Report Offensive Message For Removal


Response Number 1
Name: Matt
Date: September 10, 2003 at 05:50:31 Pacific
Reply: (edit)

Step 1> Turn off your CAPS please - thank you!

Step 2> For a batch file, input has to be given at command line, and stored as an environment variable. Unless there are new batch file rules that I'm not aware of that is.

What exactly are you trying to accomplish? That will help me understand this and help you a bit better. Thanks!


Report Offensive Follow Up For Removal

Response Number 2
Name: Sumanth Sharma
Date: September 10, 2003 at 06:09:21 Pacific
Reply: (edit)

Say, in a batch file I want to invoke a perl script. But before this I wan't to ask the
THANKS FOR REPLYING, AND THANKS IN ADVANCE IF U REPLY FOR THIS

user something like
"are you sure u want to run this script, which will delete all your temporary internet files Y/N"

NOW FROM THIS POINT ON, I WAN'T TO TAKE AN INPUT YES OR NO FROM THE USER, HOW DO I ACCOMPLISH IT IN A BATCH FILE



Report Offensive Follow Up For Removal

Response Number 3
Name: Sumanth Sharma
Date: September 10, 2003 at 06:11:10 Pacific
Reply: (edit)

Error in my last reply. Ignore it.

THANKS FOR REPLYING, AND THANKS IN ADVANCE IF U REPLY FOR THIS

Say, in a batch file I want to invoke a perl script. But before this I wan't to ask the
user something like
"are you sure u want to run this script, which will delete all your temporary internet files Y/N"

NOW FROM THIS POINT ON, I WAN'T TO TAKE AN INPUT YES OR NO FROM THE USER, HOW DO I ACCOMPLISH IT IN A BATCH FILE



Report Offensive Follow Up For Removal

Response Number 4
Name: Matt
Date: September 10, 2003 at 06:25:31 Pacific
Reply: (edit)

Are you familiar with the Choice command and error levels? Very easy to use really - some resources below:

http://www.computerhope.com/choicehl.htm

http://www.computerhope.com/batch.htm


Report Offensive Follow Up For Removal

Response Number 5
Name: Sumanth Sharma
Date: September 10, 2003 at 06:47:48 Pacific
Reply: (edit)

But mine is a NT 5.0 Machine( Windows 2000 )
CHOICE command is not available boss.
Pls help me out.


Report Offensive Follow Up For Removal


Response Number 6
Name: Matt
Date: September 10, 2003 at 06:56:08 Pacific
Reply: (edit)

Google is your friend:

http://www.computing.net/windows2000/wwwboard/forum/49954.html


Report Offensive Follow Up For Removal

Response Number 7
Name: Sumanth Sharma
Date: September 10, 2003 at 21:20:03 Pacific
Reply: (edit)

Thankx a lot Matt. The link u sent last time's really got some good stuff for me.

Thanks a lot again.


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: Reading input from a batch file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge