I have a batch file that copies files to a network location on WebDAV. The address looks something like this:
When I restart my computer, the batch file doesn’t work and says “Access denied”. Before a restart, it works, but it doesn’t after the computer restarts. The problem is that it requires me to put in the username and password used to access the server. I have to browse to the server in File Explorer and sign in first. Even if I select the “Remember password” check box, it doesn’t work.
How can I get it to automatically sign in? I don’t want to have to do this every time.
It would be best if you first map the drive to the machine you using the batch. I am using letter B for mapped drive letter .
At the start of your batch file use command line ‘net’ :-
net use B: \xxxxxxxxx.net@SSL@2078DavWWWRoot <password> /User:<username>
Where “< password >” is the password for the windows user specified as “< username >”
now have your copy command line after this . Specify the drive letter (above I have used B for drive letter) in your batch file .
XCOPY /E /Y "C:<path of the file>...<filename>" "B:<location on server>"
Once you are happy with the copy command and is working add a command to remove the mapped drive using the following command :-
net use B: /delete