Solved

map a network drive in a bat file

Posted on 2014-11-24
7
168 Views
Last Modified: 2014-11-24
Hi,

I want to be able to map a network path on my windows server with a simple bat file.

The easy command I use is this:
net use o: \\Pbtuk-639-02-13
move /-y "D:\production\*.*" "o:\e\AV Media\"
pause

Open in new window

However I get this error message when executing the file:
Net use
I have done a net view and then it was no problem to find the network path.
Net view
From what I understand the computer is shared with Everyone.

Thanks for help!

Peter
0
Comment
Question by:peternordberg
7 Comments
 
LVL 3

Expert Comment

by:Barry Molenwijk
ID: 40462354
If you go to O: in your command prompt and do a dir, do you see everything you're supposed to see?
0
 
LVL 84

Expert Comment

by:oBdA
ID: 40462364
Remove the trailing backslash in your target path for the move command:
move /-y "D:\production\*.*" "o:\e\AV Media"

Open in new window

0
 
LVL 15

Expert Comment

by:Perarduaadastra
ID: 40462373
I think the clue is in the error...

When you set up a network share, the UNC pathname should include the name of the host, and the target folder. You seem to be missing part of the pathname. It should look like this:

\\hostname\foldername

Don't forget that the folder itself must be shared and have the correct permissions.
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 4

Expert Comment

by:Jason Johanknecht
ID: 40462442
Peraduaadastra is exactly right, you need the host and share name to map a drive.  Fix that first.
0
 

Author Comment

by:peternordberg
ID: 40462580
Hi,

I changed it like this now:
net use o: "\\Pbtuk-639-02-13e\AV Media"
move /-y "D:\production\*.*" "o:\"
pause

Open in new window


But I get this error:
 bat4.png
Thanks for help!

Peter
0
 
LVL 84

Accepted Solution

by:
oBdA earned 250 total points
ID: 40462590
Try
net use o: "\\Pbtuk-639-02-13\e"
move /-y "D:\production\*.*" "o:\AV Media"
pause

Open in new window

0
 
LVL 15

Assisted Solution

by:Perarduaadastra
Perarduaadastra earned 250 total points
ID: 40462605
Get rid of the space in the pathname. Instead of AV Media, use AVMedia, AV-Media, or AV_Media...

I notice that you put quotes around the net use argument, but I don't think that works for pathnames - at least, I've never seen it used.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

828 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