简体   繁体   English

批处理xco​​py,robocopy复制到网络路径(不包含凭据),不使用网络使用

[英]batch xcopy, robocopy copy to network path w/ credentions w/o using net use

Is there a way to copy to a network path to a folder that requires credentials using any copy commands without using net use . 有没有一种方法可以使用任何复制命令复制到需要凭证的文件夹的网络路径, 而无需使用net use

Using xcopy you can achieve the goal across network path but I can not get it to take credentials 使用xcopy可以实现跨网络路径的目标,但我无法获取其凭据

xcopy /E/R/K C:\folder\ \\XXX.XXX\folder\*.*

This is what I have tried and doesn't work along, with other similar inputs. 这是我尝试过的,无法与其他类似输入配合使用。

robocopy /e C:\folder\ "\\XXX.XXX\folder\ /user:name passwrd"
xcopy /E/R/K C:\folder\ "\\XXX.XXX\folder\*.* /user:name passwrd"

Thanks. 谢谢。

The utilities don't have mechanisms to handle authentication. 该实用程序没有处理身份验证的机制。 You will have to use net use or map the drive. 您将必须使用网络使用或映射驱动器。 Not sure why you don't want to use net use, but either way the drive will need to be authenticated before using the copy utilities. 不确定为什么不想使用网络使用,但是无论哪种方式都需要在使用复制实用程序之前对驱动器进行身份验证。 Maybe try using RunAs on the xcopy and use the credentials needed. 也许尝试在xcopy上使用RunAs并使用所需的凭据。

You can also do this in an AutoIt script wrapping the RunAs function in the command line. 您也可以在AutoIt脚本中执行此操作,该脚本在命令行中包装RunAs函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM