| Windows 7: Meaning of Parameters in the XCOPY command |
27 Aug 2012
|
#1 | | Windows 7 Professional 64 |
Meaning of Parameters in the XCOPY command I'm trying to create bootable flash drives. At one point, I'm told to use the command,
xcopy f:*.* /s/e/f hg:
in which f: is the source, g: is the destination. Why am I told to type, "hg:"? What does the "h" do?
When I enter the command, Windows 7 asks me if g: refers to a file or a directory. Why would it ask this question? | My System Specs |
| System Manufacturer/Model Number Home Built OS Windows 7 Professional 64 CPU AMD Phenom II X2 560 (unlocked) 3.3 GHz Black Edition Motherboard Gigabyte 890FXA-UD5 Memory 8 GB Corsair XMS3 DDR3, 4 GB each in banks 1 & 3 Graphics Card Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA Sound Card on-board Monitor(s) Displays Dell 15" LCD monitor PSU 500 W CoolerMaster Power Plus Case CoolerMaster 690 II Advanced Mid tower Cooling 4 fans Hard Drives 2 TB Hitachi w/ 64 MB cache SATA
3 TB WD w/64 MB cache SATA
various other drives as I feel the urge |
27 Aug 2012
|
#2 | | Windows 7 Ultimate SP1 (x64) South Australia |
Hi,
There are probably easier ways to create bootable flash drives, but here is the answer to your question.
H = copies hidden and system files also
If you type xcopy /? in a cmd window, you will see this: Code:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
U:\>xcopy /?
Copies files and directory trees.
XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
[/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
[/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B]
[/EXCLUDE:file1[+file2][+file3]...]
source Specifies the file(s) to copy.
destination Specifies the location and/or name of new files.
/A Copies only files with the archive attribute set,
doesn't change the attribute.
/M Copies only files with the archive attribute set,
turns off the archive attribute.
/D:m-d-y Copies files changed on or after the specified date.
If no date is given, copies only those files whose
source time is newer than the destination time.
/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. Each string
should be in a separate line in the files. When any of the
strings match any part of the absolute path of the file to be
copied, that file will be excluded from being copied. 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.
/P Prompts you before creating each destination file.
/S Copies directories and subdirectories except empty ones.
/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.
/V Verifies the size of each new file.
/W Prompts you to press a key before copying.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
/Q Does not display file names while copying.
/F Displays full source and destination file names while copying.
/L Displays files that would be copied.
/G Allows the copying of encrypted files to destination that does
not support encryption.
/H Copies hidden and system files also.
/R Overwrites read-only files.
/T Creates directory structure, but does not copy files. Does not
include empty directories or subdirectories. /T /E includes
empty directories and subdirectories.
/U Copies only files that already exist in destination.
/K Copies attributes. Normal Xcopy will reset read-only attributes.
/N Copies using the generated short names.
/O Copies file ownership and ACL information.
/X Copies file audit settings (implies /O).
/Y Suppresses prompting to confirm you want to overwrite an
existing destination file.
/-Y Causes prompting to confirm you want to overwrite an
existing destination file.
/Z Copies networked files in restartable mode.
/B Copies the Symbolic Link itself versus the target of the link.
/J Copies using unbuffered I/O. Recommended for very large files.
The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.
U:\> Regards,
Golden | My System Specs | | Computer type PC/Desktop System Manufacturer/Model Number Golden Mk. I.3 OS Windows 7 Ultimate SP1 (x64) CPU Intel i7 860 @ 2.80 GHz Motherboard Gigabyte P55A-UD3R Rev.1. Award BIOS F13 Memory 16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24) Graphics Card EVGA NVidia GTX 560 1024MB Sound Card Realtek Integrated Monitor(s) Displays Dual Samsung SyncMaster 2494HS Screen Resolution 1920*1080 and 1920*1080 Keyboard Logitech G110 Mouse Logitech MX518 PSU Thermaltake ToughPower QFan 750W Case Thermaltake Element S VK60001W2Z Cooling Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans Hard Drives 1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
3*Samsung F1 SpinPoint 1TB in RAID5;
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0 Internet Speed Not fast enough!!! Antivirus MSE and Malwarebytes Pro Browser Chrome Version 25 Other Info Laptop: ASUS X54C, Intel Core i3-2330M @ 2.0Ghz, 4GB RAM, Intel HD on-board graphics, Windows 7 Professional SP1 (x64), LinuxMint 14 (x64), PepperMint 3 (x86) |
27 Aug 2012
|
#3 | | |
Also this Gui describes each switch if you hover the mouse: Simplify file management with the XCopy Tool | TechRepublic
Handy if you don't use XCopy often. | My System Specs | | System Manufacturer/Model Number HP Media Center OS Windows 7 32 bit CPU AMD 5200+ dual core Memory 2 GB Graphics Card NVidia GeForce 6150SE 128 MB Monitor(s) Displays CRT Screen Resolution 1280x1024 Keyboard PS/2 Mouse PS/2 Wheel Mouse Hard Drives 500 GB Sata internal :
SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives Other Info SIIG USB 3.0 PCIexpress card. |
27 Aug 2012
|
#4 | | Windows 7 Professional 64 |
Thank you for your answers, but I am not sure about one point. The switch, /h, copies hidden files, but the command I question is a parameter that does not have a switch designator that I recognize ("hg:"). I don't see that the original command had a /h specified in it. | My System Specs | | System Manufacturer/Model Number Home Built OS Windows 7 Professional 64 CPU AMD Phenom II X2 560 (unlocked) 3.3 GHz Black Edition Motherboard Gigabyte 890FXA-UD5 Memory 8 GB Corsair XMS3 DDR3, 4 GB each in banks 1 & 3 Graphics Card Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA Sound Card on-board Monitor(s) Displays Dell 15" LCD monitor PSU 500 W CoolerMaster Power Plus Case CoolerMaster 690 II Advanced Mid tower Cooling 4 fans Hard Drives 2 TB Hitachi w/ 64 MB cache SATA
3 TB WD w/64 MB cache SATA
various other drives as I feel the urge |
27 Aug 2012
|
#5 | | Windows 7 Ultimate SP1 (x64) South Australia |

Quote: Originally Posted by Pooua xcopy f:*.* /s/e/f hg: Hi,
Is it possible your command was mistyped? I think it should say: Code:
xcopy f:*.* /s/e/f/h g: Since you mentioned you are copying to G: - notice the space between h and g
Regards,
Golden | My System Specs | | Computer type PC/Desktop System Manufacturer/Model Number Golden Mk. I.3 OS Windows 7 Ultimate SP1 (x64) CPU Intel i7 860 @ 2.80 GHz Motherboard Gigabyte P55A-UD3R Rev.1. Award BIOS F13 Memory 16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24) Graphics Card EVGA NVidia GTX 560 1024MB Sound Card Realtek Integrated Monitor(s) Displays Dual Samsung SyncMaster 2494HS Screen Resolution 1920*1080 and 1920*1080 Keyboard Logitech G110 Mouse Logitech MX518 PSU Thermaltake ToughPower QFan 750W Case Thermaltake Element S VK60001W2Z Cooling Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans Hard Drives 1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
3*Samsung F1 SpinPoint 1TB in RAID5;
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0 Internet Speed Not fast enough!!! Antivirus MSE and Malwarebytes Pro Browser Chrome Version 25 Other Info Laptop: ASUS X54C, Intel Core i3-2330M @ 2.0Ghz, 4GB RAM, Intel HD on-board graphics, Windows 7 Professional SP1 (x64), LinuxMint 14 (x64), PepperMint 3 (x86) |
28 Aug 2012
|
#6 | | Windows 7 Professional 64 |

Quote: Originally Posted by Golden 
Quote: Originally Posted by Pooua xcopy f:*.* /s/e/f hg: Hi,
Is it possible your command was mistyped? I think it should say: Code:
xcopy f:*.* /s/e/f/h g: Since you mentioned you are copying to G: - notice the space between h and g
Regards,
Golden It's possible. However, 2 Web sites have the exact same command, each left unedited for 3 years. If the command had a typo, I would expect DOS/Windows to complain, but it doesn't. I did a straight copy-and-paste from the Web site. So, I don't think it's a typo. Even if it were, Windows somehow still knows to do something with it. | My System Specs | | System Manufacturer/Model Number Home Built OS Windows 7 Professional 64 CPU AMD Phenom II X2 560 (unlocked) 3.3 GHz Black Edition Motherboard Gigabyte 890FXA-UD5 Memory 8 GB Corsair XMS3 DDR3, 4 GB each in banks 1 & 3 Graphics Card Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA Sound Card on-board Monitor(s) Displays Dell 15" LCD monitor PSU 500 W CoolerMaster Power Plus Case CoolerMaster 690 II Advanced Mid tower Cooling 4 fans Hard Drives 2 TB Hitachi w/ 64 MB cache SATA
3 TB WD w/64 MB cache SATA
various other drives as I feel the urge |
28 Aug 2012
|
#7 | | Windows 7 Ultimate SP1 (x64) South Australia |
Hi,
I can't find any reference to /hg, so I'm guessing it is a typo. Here is why:
Its prompting you whether G: is a drive or directory. Quite simply, it recognises /h but not the g afterwards, hence the prompt.
If you were to replace g with x for example such as /hx, I suspect it would prompt you whether x is a drive or directory too. Xcopy
Regards,
Golden | My System Specs | | Computer type PC/Desktop System Manufacturer/Model Number Golden Mk. I.3 OS Windows 7 Ultimate SP1 (x64) CPU Intel i7 860 @ 2.80 GHz Motherboard Gigabyte P55A-UD3R Rev.1. Award BIOS F13 Memory 16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24) Graphics Card EVGA NVidia GTX 560 1024MB Sound Card Realtek Integrated Monitor(s) Displays Dual Samsung SyncMaster 2494HS Screen Resolution 1920*1080 and 1920*1080 Keyboard Logitech G110 Mouse Logitech MX518 PSU Thermaltake ToughPower QFan 750W Case Thermaltake Element S VK60001W2Z Cooling Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans Hard Drives 1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
3*Samsung F1 SpinPoint 1TB in RAID5;
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0 Internet Speed Not fast enough!!! Antivirus MSE and Malwarebytes Pro Browser Chrome Version 25 Other Info Laptop: ASUS X54C, Intel Core i3-2330M @ 2.0Ghz, 4GB RAM, Intel HD on-board graphics, Windows 7 Professional SP1 (x64), LinuxMint 14 (x64), PepperMint 3 (x86) |
28 Aug 2012
|
#8 | | Windows 7 Professional 64 |
I just tried an experiment. My active directory remained on C:, and I tried both
xcopy k:*.* /s/e/f hq:
and
xcopy k:*.* /s/e/f/h q:
These 2 commands do not give the same result. The former command copies files from k: to c:. The latter command copies from k: to q: That doesn't rule out Windows simply ignoring the "h" in the original command, but it does show it is not treating the "h" as "/h." | My System Specs | | System Manufacturer/Model Number Home Built OS Windows 7 Professional 64 CPU AMD Phenom II X2 560 (unlocked) 3.3 GHz Black Edition Motherboard Gigabyte 890FXA-UD5 Memory 8 GB Corsair XMS3 DDR3, 4 GB each in banks 1 & 3 Graphics Card Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA Sound Card on-board Monitor(s) Displays Dell 15" LCD monitor PSU 500 W CoolerMaster Power Plus Case CoolerMaster 690 II Advanced Mid tower Cooling 4 fans Hard Drives 2 TB Hitachi w/ 64 MB cache SATA
3 TB WD w/64 MB cache SATA
various other drives as I feel the urge |
28 Aug 2012
|
#9 | | |
For me, it asks a question:
It does exactly what I would expect it to do.
Let's move on from figuring out if it is a typo and concentrate on figuring out if the switches do what you want them to do.
Do you see hidden files on the K drive?
If yes, are they being copied? | My System Specs | | System Manufacturer/Model Number Employer provided Dell E6430 OS W7 Pro SP1 64bit CPU i5 3320M @ 2.6GHz Motherboard 0CPWYR Memory 4GB Graphics Card Intel HD Graphics 4000 Screen Resolution 1600 x 900 Hard Drives 119GB LITEONIT SSD Antivirus Employer mandated Symantec Endpoint Protection Browser Firefox, IE9 & IE8 via VM Meaning of Parameters in the XCOPY command problems? All times are GMT -5. The time now is 09:46 AM. | |