Home > Tin học > Sử dụng xcopy trong cmd của windows

Sử dụng xcopy trong cmd của windows

Trưởng hợp các bạn copy cả hổ cứng, nếu chúng ta sử dụng copy paste thông thường thì máy chạy rất lâu, vì dự liệu copy là hàng Gb.
Do đó sử dụng cmd với Xcopy sẽ giúp bạn nhanh hơn (Nếu dự liệu lớn)

Cú pháp như sau: XCOPY source [destination] [options]

source: có thể là file, thư mục,..vv
destination: nơi copy đến (ví dụ như paste)
option: các tùy chon cho việc copy

Ví dụ:
Copy file:
XCOPY C:\utils\MyFile D:\Backup\CopyFile
Copy thư mục (folder):
XCOPY C:\utils D:\Backup\utils /i
Copy folder và subfolders.
XCOPY C:\utils\* D:\Backup\utils /s /i
The /i defines the destination as a folder.

Ngoài ra các bạn xem thêm các thuộc tính khác bên dưới

Source Options
/A Copy files with the archive attribute set (default=Y)
/M Copy files with the archive attribute set and turn off the archive attribute, use this option when making regular Backups (default=Y)
/H Copy hidden and system files and folders (default=N)
Copy files changed on or after the specified date. If no date is given, copy only files whose source date/time is newer than the destination time.
/U Copy only files that already exist in destination.
/S Copy folders and subfolders
/E Copy folders and subfolders, including Empty folders. May be used to modify


(Windows 2000 only) The files can each contain one
or more full or partial pathnames to be excluded.
When any of these match any part of the absolute path
of a SOURCE file, then that file will be excluded.
For example, specifying a string like \obj\ or .obj will exclude
all files underneath the directory obj or all files with the
.obj extension respectively. Copy Options
/W Prompt you to press a key before starting to copy.
/P Prompt before creating each file.

/Y (Windows 2000 only) Suppress prompt to confirm overwriting a file.
may be preset in the COPYCMD env variable.
/-Y (Windows 2000 only) Prompt to confirm overwriting a file.
/V Verify that the new files were written correctly.
/C Continue copying even if an error occurs.
/I If in doubt always assume the destination is a folder e.g. when the destination does not exist.
/Z Copy files in restartable mode. If the copy is interrupted part way through, it will restart if possible. (use on slow networks)
/Q Do not display file names while copying.
/F Display full source and destination file names while copying.
/L List only – Display files that would be copied.
Destination Options
/R Overwrite read-only files.
/T Create folder structure, but do not copy files. Do not
include empty folders or subfolders.
/T /E will include empty folders and subfolders.
/K Copy attributes. XCOPY will otherwise reset read-only attributes.
/N If at all possible, use only a short filename (8.3) when creating
a destination file. This may be nececcary when copying between disks
that are formatted differently e.g NTFS and VFAT, or when archiving
data to an ISO9660 CDROM.

/O (Windows 2000 only) copy file Ownership and ACL information.

/X Copy file audit settings (implies /O).

Categories: Tin học Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: