views:

23

answers:

1

The environment is Windows Web Server 2008, and I'm just trying to copy a folder full of files to a network location (a managed backup network folder). Here is my .bat file, running in the folder with my .bat files:

copy *.bak \\networklocation\*.bak
pause

however \\networklocation requires username x and password y, so running the script gives:

Logon failure: unknown user name or bad password.

I can't figure out a way to supply my credentials. I tried creating a scheduled task and modifying the security options, but this only seems to allow you to use credentials relevant to the machine (i.e. I try putting in username x and it can't find it).

How do I run this script with all the right permissions?

Solution:

net use \\networklocation\sharefolder password /USER:username
copy \*.bak \\networklocation\sharefolder\*.bak
A: 

Try this

net use \\networklocation\ password /USER:username
Max
So I tried adding this before my copy command, and I get "The network path was not found". If I type \\networklocation\ into explorer it works and brings up the password box, so I know the location is correct. I'm actually using the ip address too (\\x.x.x.x\) so I'd really have thought it shouldn't have a problem with the location.
Zac
Try to use some folder in the network path. \\networklocation\folder
Max
Thanks! Needed a folder specifying. Makes plenty of sense actually, I guess you can't use the root because it's not really a root, is it? Just somewhere that has some shared folders within it.
Zac
Yes it doesn't work without a folder.
Max