Map drive via bat file

RISLA
RISLA used Ask the Experts™
on
Hoping to get some assistance using a bat file to map (or re-connect) a network drive.

I need the bat file to include a username and password.

The current bat file doesn't work:

net use H: \\SERVER\D$ PASSWORD /user:adminstrator
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
If you are already connected as a different user to the same user then you can't.... you could create a new share to d:\ whch had share permissions for your user though?

What error do you get?

Steve

Author

Commented:
Problem is that it keep becoming disconnected. This bat file is used to reconnect the drive.

Commented:
add /persistent:yes to the end
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Top Expert 2012
Commented:
net use \\server\share /user:user password
 

Author

Commented:
THANKS!
Bill PrewIT / Software Engineering Consultant
Top Expert 2016

Commented:
Just so I can learn, how does the accepted solution resolve the problem.  It doesn't include a drive letter, and for the version of NET.EXE I have it shows the password coming before the /user: parm, not after?

~bp

Commented:
and you said it works but kept disconnectng, after first saying not working?!

Commented:
A bit confused here myself too and would like to learn more...
How does the accepted solution work when it doesn't include a drive letter, and how does it address the original problem of disconnection?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial