如何通过cmd复制一个文件夹?

时间:2022-03-14 00:29:43

I want to make a .bat file that when opened will copy a folder and all it contains into another folder on another partition. Here is exactly what I am trying to do:

我想要创建一个.bat文件,当打开时,它将复制一个文件夹,并将其包含到另一个分区的另一个文件夹中。这正是我想要做的:

Copy C:\Documents and Settings\user\Desktop\Документи and all it contains to D:\Backup. I have tried with many xcopy commands but without result. Thanks.

(2)将用户的所有内容复制到D:\备份中。我尝试了许多xcopy命令,但没有结果。谢谢。

I launched the command prompt with /k and saw this

我用/k启动了命令提示符,看到了这个。

如何通过cmd复制一个文件夹?

which made me think there is a problem with the font. I installed new font that should fix this (YGP_NT) but I am having the same problem (yes, I changed it from the cmd Properties, edited the TrueTypeFont with regedit and restarted the PC). I can write in cyrillic in the cmd if that can help.

这让我觉得字体有问题。我安装了新的字体(YGP_NT),但是我遇到了同样的问题(是的,我从cmd属性中修改了它,用regedit编辑了TrueTypeFont,重新启动了PC)。如果可以的话,我可以在cmd中写cyrillic。

3 个解决方案

#1


38  

xcopy "%userprofile%\Desktop\Документи" "D:\Backup\" /s/h/e/k/f/c

should work, assuming that your language setting allows Cyrillic (or you use Unicode fonts in the console).

假设您的语言设置允许使用Cyrillic(或者在控制台中使用Unicode字体)。

For reference about the arguments: http://ss64.com/nt/xcopy.html

有关参数:http://ss64.com/nt/xcopy.html。

#2


10  

xcopy  e:\source_folder f:\destination_folder /e /i /h

The /h is just in case there are hidden files. The /i creates a destination folder if there are muliple source files.

h只是以防有隐藏的文件。如果有muliple源文件,则创建一个目标文件夹。

#3


7  

xcopy  "C:\Documents and Settings\user\Desktop\Документи" "D:\Backup" /s /e /y /i

Probably the problem is the space.Try with quotes.

可能问题在于空间。尝试用引号。

#1


38  

xcopy "%userprofile%\Desktop\Документи" "D:\Backup\" /s/h/e/k/f/c

should work, assuming that your language setting allows Cyrillic (or you use Unicode fonts in the console).

假设您的语言设置允许使用Cyrillic(或者在控制台中使用Unicode字体)。

For reference about the arguments: http://ss64.com/nt/xcopy.html

有关参数:http://ss64.com/nt/xcopy.html。

#2


10  

xcopy  e:\source_folder f:\destination_folder /e /i /h

The /h is just in case there are hidden files. The /i creates a destination folder if there are muliple source files.

h只是以防有隐藏的文件。如果有muliple源文件,则创建一个目标文件夹。

#3


7  

xcopy  "C:\Documents and Settings\user\Desktop\Документи" "D:\Backup" /s /e /y /i

Probably the problem is the space.Try with quotes.

可能问题在于空间。尝试用引号。