Solved

How do I stop a .bat file asking for a username and password?

Posted on 2007-11-26
5
842 Views
Last Modified: 2008-02-24
I have created a batch file which maps a number of network drives from two different file servers.

When it runs, it asks for a username and password so that it can create the network drive on FS1. However, it does not ask for a username and password when connecting to FS2.

I want the user to have to enter their login details when they try to access the drive through My Computer, and not by entering them into the .bat file.

Any assistance is appreciated.
0
Comment
Question by:finpjenn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Expert Comment

by:jimmymcp02
ID: 20361502
you could do the following

net use g: \\serveraddress\c$ yourpassword /user:Yourusername
0
 
LVL 20

Expert Comment

by:jimmymcp02
ID: 20361512
ooppps... read to quickly..... thats not what you asked for.
0
 

Author Comment

by:finpjenn
ID: 20362028
lol, no problem, thank you for trying anyways.
0
 
LVL 9

Expert Comment

by:bigjimbo813
ID: 20371783
Are the credentials the same on both servers?
Are they both on the same domain?
If not are the domains trusted?

I dont think there is a way to request credentails after the drive has been mapped (assuming connection wasnt killed).
0
 
LVL 29

Accepted Solution

by:
matrixnz earned 500 total points
ID: 20388004
Hi finpjenn

You can do it using a persistant drive mapping, however initially they would need to enter there details using the batch, for example

NET USE G: \\SERVER1\SHARE /user:DOMAIN\%USERNAME% /PERSISTENT:YES
NET USE H: \\SERVER2\SHARE /PERSISTENT:YES

When the user restarts or logs off and back on again the mapped drives will exist but when clicked should prompt the user for their username and password.

Although if you were in a domain environment the user shouldn't have to enter a username and password at all, as authentication should be done at logon.

Hope that helps.

Cheers
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question