How to give credentials in a batch script that copies files to a network location?

前端 未结 2 1341
后悔当初
后悔当初 2020-12-13 12:48

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

相关标签:
2条回答
  • 2020-12-13 13:17

    You can also map the share to a local drive as follows:

    net use X: "\\servername\share" /user:morgan password
    
    0 讨论(0)
  • 2020-12-13 13:18

    Try using the net use command in your script to map the share first, because you can provide it credentials. Then, your copy command should use those credentials.

    net use \\<network-location>\<some-share>\ password /USER:username
    
    0 讨论(0)
提交回复
热议问题