Xcopy to or from password protected network folder

To copy contents of a password protected network shared folder in one server to another server, you can use xcopy command.

Syntax of xcopy command is:
xcopy source [destination] [/a | /m] [/d:date] [/p] [/s] [/e] [/w] [/c] [/i] [/q] [/f] [/l] [/h] [/r] [/t] [/u] [/k] [/n]

You can use this code in a scheduled batch script on your backup server, to copy contents of a backup folder from a server in other or the same domain:

net use F: \\192.168.7.21\Backup /user:domain\user_name p@ssw0rd /persistent:no
xcopy F: D:\Database_Backup\ /y

It uses the Net Use command to map a network drive (as F: drive for example), using a username and password of a user with access permissions on that folder and with non persistent connection.
/y switch overwrites existing files without prompting you.

You can see switches that you can use with Xcopy and Xcopy32 Commands here:

http://support.microsoft.com/kb/289483

If the post helped you, please share it:
Pin It

1 comment to Xcopy to or from password protected network folder

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">