map a network drive in a bat file

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
peternordbergAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
oBdAConnect With a Mentor Commented:
Try
net use o: "\\Pbtuk-639-02-13\e"
move /-y "D:\production\*.*" "o:\AV Media"
pause

Open in new window

0
 
Barry MolenwijkTechnical Support Specialist IICommented:
If you go to O: in your command prompt and do a dir, do you see everything you're supposed to see?
0
 
oBdACommented:
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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
PerarduaadastraCommented:
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
 
Jason JohanknechtIT ManagerCommented:
Peraduaadastra is exactly right, you need the host and share name to map a drive.  Fix that first.
0
 
peternordbergAuthor Commented:
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
 
PerarduaadastraConnect With a Mentor Commented:
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
All Courses

From novice to tech pro — start learning today.