Link to home
Start Free TrialLog in
Avatar of Peter Nordberg
Peter NordbergFlag for Sweden

asked on

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:
User generated image
I have done a net view and then it was no problem to find the network path.
User generated image
From what I understand the computer is shared with Everyone.

Thanks for help!

Peter
Avatar of Barry Molenwijk
Barry Molenwijk
Flag of Netherlands image

If you go to O: in your command prompt and do a dir, do you see everything you're supposed to see?
Avatar of oBdA
oBdA

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

Open in new window

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.
Peraduaadastra is exactly right, you need the host and share name to map a drive.  Fix that first.
Avatar of Peter Nordberg

ASKER

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:
 User generated image
Thanks for help!

Peter
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial