?
Solved

Map a network drive and assign a drive letter with a batch file

Posted on 2006-11-28
5
Medium Priority
?
406 Views
Last Modified: 2010-04-10
Hi

I have a program that needs a mapped drive to exist.  I have a batch file that runs each time the user logs in.  I would like to add a line that add a batch file that creates a mapped drive with a drive letter and path to my files.
I already have one in the user profile of Active directory so I need another one as a batch file.  How do you do that?

Mike
0
Comment
Question by:MickaelE
[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
  • 2
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
ryandale56 earned 2000 total points
ID: 18032555
net use Z: \\server\share

(where Z: is whatever drive letter you want)
0
 
LVL 7

Expert Comment

by:dlangr
ID: 18032560
in the batchfile add:

net use delete g:
net use g: \\server\share

You can use any letter you like, not just g, as log as it is still free.

type: net use /?   from the command line for help
0
 
LVL 7

Expert Comment

by:dlangr
ID: 18032564
log = long
0
 
LVL 6

Expert Comment

by:ryandale56
ID: 18032618
if you are going to add the "net use /delete g:"  it is /delete no just delete....notice the leading slash.
0
 

Expert Comment

by:vk3jed
ID: 18033650
I always find the method below is the most reliable

net use X: \\server\share /yes /persist:no

What this does is maps X: to \\server\share.  /yes means answer "yes" to any prompts, without stopping for user input, and /persist:no means that the share won't be persistent (remapped) at next login.  This can help with unexpected issues (e.g. if the bat file lives on a server or the server hosting the share is down at the time, it won't be mapped.  Therefore, the absence of X: can be an sign there is a problem, and you won't have Windows being bogged down by trying to access a nonexistent network drive.

Before running the batch file for the first time, make sure that the drive letter to be used is not mapped (X: in the example above).
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

Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

800 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