Computing.Net > Forums > Programming > Prompt for Variable in Batch File

Prompt for Variable in Batch File

Reply to Message Icon

Original Message
Name: tolksee
Date: April 1, 2005 at 07:35:34 Pacific
Subject: Prompt for Variable in Batch File
OS: Win2k, NT
CPU/Ram: P4 / 512
Comment:

Hi,

I have a batch file that runs a command with parameters. The batch file contains just one line - EG:

program.exe -uUsername -pPassword -cConnection

I would like to have the user prompted to enter thier username and passoword when they run the batch file, rather than have a USername & PAssword hard-coded in the batch file. How can I do this?

Thanks for your help!

Lee



Report Offensive Message For Removal


Response Number 1
Name: dtech10
Date: April 1, 2005 at 07:53:03 Pacific
Reply: (edit)

Hi
This help works in WinXp

@echo off
echo "Enter Username"
set /p UserName=

echo "Password"
set /p PassWord=

echo %UserName% %PassWord%


Report Offensive Follow Up For Removal

Response Number 2
Name: tolksee
Date: April 1, 2005 at 07:57:21 Pacific
Reply: (edit)

Excelent, works a treat!! Thanks for the reply.


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: Prompt for Variable in 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 Today.
Discuss in The Lounge