windows 使用批处理文件创建文件夹并将文件复制到多台PC

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2874308/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 07:20:03  来源:igfitidea点击:

Using a batch file to create folder and copy files into it to multiple PCs

windowsbatch-file

提问by Greg

I have a folder with numerous files that I need to copy to multiple PCs on a network. I thought if the folder didn't exist it would automatically create it. Here's what I have...

我有一个包含大量文件的文件夹,我需要将这些文件复制到网络上的多台 PC。我想如果该文件夹不存在它会自动创建它。这是我所拥有的...

copy "C:\Documents and Settings\follag\Desktop\Music" "\PC NAME\c$\Documents and Settings\All Users\Desktop\Music"

复制“C:\Documents and Settings\follag\Desktop\Music”“\PC NAME\c$\Documents and Settings\All Users\Desktop\Music”

When I look at the destination PC, it is not creating the folder and copying the files. I'm new to this whole batch files and would appreciate any help.

当我查看目标 PC 时,它不会创建文件夹并复制文件。我是整个批处理文件的新手,希望得到任何帮助。

Thanks,

谢谢,

Greg

格雷格

回答by LittleBobbyTables - Au Revtheitroad

Try

尝试

xcopy "C:\Documents and Settings\follag\Desktop\Music" "\PC NAME\c$\Documents and Settings\All Users\Desktop\Music" /E /I

回答by Joe Enos

You only have a single backslash at the start of your second argument instead of two. Don't know if that's just a typo when copying here to SO. If not, then there's your problem.

在第二个参数的开头只有一个反斜杠,而不是两个。不知道在复制到 SO 时这是否只是一个错字。如果没有,那就是你的问题。