65

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:

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.

I launched the command prompt with /k and saw this

pic

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.

phuclv
  • 37,963
  • 15
  • 156
  • 475
Yordan Sirakov
  • 681
  • 3
  • 7
  • 9
  • If you've "tried with many xcopy commands", certainly you should be able to include some of them in your post. Please [edit] to do so, and explain how they don't work as you'd expect. – Ken White Oct 22 '13 at 13:53
  • change the character set, not the font (although you should change to a true type font for better Unicode support and rendering). Use `chcp ` with your Russian codepage, or [`chcp 65001`](http://stackoverflow.com/q/388490/995714) for changing to UTF-8 – phuclv Apr 23 '17 at 01:59

3 Answers3

55
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).

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

The Student
  • 27,520
  • 68
  • 161
  • 264
Joey
  • 344,408
  • 85
  • 689
  • 683
  • 2
    +1 As you are using a non-default character set then you may have issues with the characters and need to use the `CP` command to change the code page before executing the xcopy command. You may get a `path not found` error otherwise. I added some switches to the xcopy command, plus quotes and slash – foxidrive Oct 22 '13 at 15:09
  • 2
    This didn't work, the cmd just flashes and the Backup folder is still empty. I checked the paths and all seems fine. – Yordan Sirakov Oct 24 '13 at 11:23
  • 3
    Trying with "/s/h/e/k/f/c" on command prompt, I was asked if it is a file or directory I wanted to copy. Try with the parameters /E /C /I /Y. – Chiranjib Oct 01 '14 at 08:31
  • 1
    I would remove /c – The Student Dec 28 '16 at 18:14
27
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.

spencer.sm
  • 19,173
  • 10
  • 77
  • 88
harry gates
  • 423
  • 3
  • 2
12
xcopy  "C:\Documents and Settings\user\Desktop\Документи" "D:\Backup" /s /e /y /i

Probably the problem is the space.Try with quotes.

npocmaka
  • 55,367
  • 18
  • 148
  • 187