Computing.Net > Forums > Programming > DOS variables batch file

DOS variables batch file

Reply to Message Icon

Original Message
Name: Flaming
Date: April 30, 2004 at 05:41:22 Pacific
Subject: DOS variables batch file
OS: XP
CPU/Ram: P4
Comment:

I'm having a little prob using variables...
I know how to assign one :
set var=3
echo %var%

This is easy... But how can I make the user fill in the value during my long batch file ? What I mean is that in my example value "3" is unknown and needs to filled out by the user during the batch file. So not with %1 and %2 that needs to be typed when the batch file is started, this does not work for me...

Any help ?

Thx.


Report Offensive Message For Removal

Response Number 1
Name: IVO
Date: April 30, 2004 at 06:20:00 Pacific
Subject: DOS variables batch file
Reply: (edit)

Use the interactive format for the Set command, so

Set /P MyVar=Enter your value...
Echo %MyVar%

that issues the message "Enter your value..." and waits untill anything is keyed in.

The /P switch works under Win NT/2K/XP only and to know more type Set /? at prompt.


Report Offensive Follow Up For Removal

Response Number 2
Name: Flaming
Date: April 30, 2004 at 06:46:36 Pacific
Subject: DOS variables batch file
Reply: (edit)

Thx IVO ! This worked like a charm :)


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: DOS variables batch file

Comments:

 


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