?
Solved

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

Posted on 2007-11-26
5
Medium Priority
?
843 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

765 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