Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file. Map a drive without a user name so user name and password

Status
Not open for further replies.

WildTurkey101

IS-IT--Management
Oct 21, 2010
6
US
Good Day.
I have a need for a batch file to map a drive for multiple users. It would need to prompt the user for their user name, and then their password.

In the old days for a single user I would do:
net use K: "\\ServerName\userdisk\Folder1" /user:Domain Name\JUser /persistent:no

This batch file displays the username and then asks for the user's password when executed. Is there a syntax that would ask for both the username, then the password?

Thank you
 
I believe you can use the /P switch for the SET command to request user input.

Code:
SET /P variablename=[TexttoShow]

Code:
SET /P username=Input User Name:
SET /P thepass=Input Pasword:


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top