Solved

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

Posted on 2007-11-26
5
835 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
5 Comments
 
LVL 20

Expert Comment

by:jimmymcp02
Comment Utility
you could do the following

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

Expert Comment

by:jimmymcp02
Comment Utility
ooppps... read to quickly..... thats not what you asked for.
0
 

Author Comment

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

Expert Comment

by:bigjimbo813
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Windows 7 does not have the best desktop search built in. This is something Windows 7 users have struggled with. You type something in, and your search results don’t always match what you are looking for, or it doesn’t actually work at all. There ar…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now