map a network drive in a bat file

Posted on 2014-11-24
Medium Priority
Last Modified: 2014-11-24

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\"

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!

Question by:peternordberg
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

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?
LVL 85

Expert Comment

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

LVL 15

Expert Comment

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:


Don't forget that the folder itself must be shared and have the correct permissions.
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.


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.

Author Comment

ID: 40462580

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

Open in new window

But I get this error:
Thanks for help!

LVL 85

Accepted Solution

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

Open in new window

LVL 15

Assisted Solution

Perarduaadastra earned 1000 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.

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

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

The following article is comprised of the pearls we have garnered deploying virtualization solutions since Virtual Server 2005 and subsequent 2008 RTM+ Hyper-V in standalone and clustered environments.
A small collection of useful tips and tricks for Windows 10 users that I decided to write as a result of recent questions that were asked and answered at Experts Exchange. Two short video tutorials included. Enjoy..
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Suggested Courses

765 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