不支持 UNC 路径
UNC Paths are not supported
我正在尝试使用以下批处理脚本将文件复制到文件夹
echo xcopy \path1\file.txt \path2\backup
但是,我收到以下错误:
UNC paths are not supported. Defaulting to the windows directory.
有没有简单的解决方案?
对于单个文件复制,只需使用copy
copy /Y \path1\file.txt \path2\backup
创建网络共享的其他方法:
for /f "tokens=2" %i in ('net use * \server1\folder\') do set src=%%i & goto :continue
:continue
for /f "tokens=2" %i in ('net use * \server2\backup\') do set dest=%%i & goto :cp
:cp
copy %src%\file.txt %dest% /Y
net use /d %src%
net use /d %dest%
只有当您已经设置了凭据时,以上内容才有效。如果没有,您可以按以下方式进行操作:
net use \server1\IPC$ /user:username password
我正在尝试使用以下批处理脚本将文件复制到文件夹
echo xcopy \path1\file.txt \path2\backup
但是,我收到以下错误:
UNC paths are not supported. Defaulting to the windows directory.
有没有简单的解决方案?
对于单个文件复制,只需使用copy
copy /Y \path1\file.txt \path2\backup
创建网络共享的其他方法:
for /f "tokens=2" %i in ('net use * \server1\folder\') do set src=%%i & goto :continue
:continue
for /f "tokens=2" %i in ('net use * \server2\backup\') do set dest=%%i & goto :cp
:cp
copy %src%\file.txt %dest% /Y
net use /d %src%
net use /d %dest%
只有当您已经设置了凭据时,以上内容才有效。如果没有,您可以按以下方式进行操作:
net use \server1\IPC$ /user:username password