Solved

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

Posted on 2007-11-26
5
841 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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
ejb wildfly example 2 103
C qsort compare function issue 6 67
Windows Batch File - pass parameter with embedded space 7 43
msiexec won't run 4 13
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…

740 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