tags:

views:

274

answers:

2

I'm running an xcopy command in a batch script which copies a file to a shared drive on another workstation; however the workstation requires a login before connecting to the share. Is there a way to script the login/connect into the batch file?

thanks in advance

+1  A: 

You can use net use to map a temporary drive and login using the credentials. This is what we had to do. Perhaps there is a better way. Then at the end of the script we unmap the drive.

Here is a link to the net use command: http://www.cezeo.com/tips-and-tricks/net-use-command/

Jeremy Reagan
+4  A: 

You can use the "net use x:\servername\sharename /u:username password" command to login to the share within the batch file. However putting the password into a plaintext batch file is generally a bad idea.

Alistair McMillan