windows 使用 BAT 从网络共享复制
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Copying from network share using BAT
提问by Mike
What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use "net use *" but using this approach how can I get the drive letter?
使用 Windows 批处理文件将文件从网络共享复制到本地文件系统的最佳方法是什么?通常,我会使用“net use *”,但是使用这种方法如何获取驱动器号?
回答by Mark Biek
Can you just use the full UNC path to the file?
您可以只使用文件的完整 UNC 路径吗?
copy \myserver\myshare\myfolder\myfile.txt c:\myfiles
回答by Joel Coehoorn
You can specify the drive letter for net use
. Put this in the command prompt for more info:
您可以为 指定驱动器号net use
。将其放在命令提示符中以获取更多信息:
net use /?
回答by Wasif Hasan
You can also use xcopy
and robocopy
:
您还可以使用xcopy
和robocopy
:
xcopy "\server\share\path" "destination"
robocopy "\server\share\path" "destination"