Meaning of Parameters in the XCOPY command

Pooua

New member
Local time
12:20 AM
Messages
11
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 Computer My Computer

At a glance

Windows 7 Professional 64AMD Phenom II X2 560 (unlocked) 3.3 GHz Black...8 GB Corsair XMS3 DDR3, 4 GB each in banks 1 & 3Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA
Computer 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(s)
Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA
Sound Card
on-board
Monitor(s) Displays
Dell 15" LCD monitor
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
PSU
500 W CoolerMaster Power Plus
Case
CoolerMaster 690 II Advanced Mid tower
Cooling
4 fans
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 Computer My Computer

At a glance

Windows 10 Pro x64 ; Xubuntu x64Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz16GB Corsair Vengance DDR3 @ 661 MHz Dual Cha...EVGA NVidia GTX 560 1024MB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518

My Computer My Computer

At a glance

Windows 7 32 bitAMD 5200+ dual core2 GBNVidia GeForce 6150SE 128 MB
Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
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 Computer My Computer

At a glance

Windows 7 Professional 64AMD Phenom II X2 560 (unlocked) 3.3 GHz Black...8 GB Corsair XMS3 DDR3, 4 GB each in banks 1 & 3Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA
Computer 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(s)
Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA
Sound Card
on-board
Monitor(s) Displays
Dell 15" LCD monitor
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
PSU
500 W CoolerMaster Power Plus
Case
CoolerMaster 690 II Advanced Mid tower
Cooling
4 fans
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[B][COLOR=red]/[/COLOR][/B]h [COLOR=red][B]g:[/B][/COLOR]
Since you mentioned you are copying to G: - notice the space between h and g

Regards,
Golden
 

My Computer My Computer

At a glance

Windows 10 Pro x64 ; Xubuntu x64Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz16GB Corsair Vengance DDR3 @ 661 MHz Dual Cha...EVGA NVidia GTX 560 1024MB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
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[B][COLOR=red]/[/COLOR][/B]h [COLOR=red][B]g:[/B][/COLOR]
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 Computer My Computer

At a glance

Windows 7 Professional 64AMD Phenom II X2 560 (unlocked) 3.3 GHz Black...8 GB Corsair XMS3 DDR3, 4 GB each in banks 1 & 3Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA
Computer 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(s)
Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA
Sound Card
on-board
Monitor(s) Displays
Dell 15" LCD monitor
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
PSU
500 W CoolerMaster Power Plus
Case
CoolerMaster 690 II Advanced Mid tower
Cooling
4 fans
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 Computer My Computer

At a glance

Windows 10 Pro x64 ; Xubuntu x64Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz16GB Corsair Vengance DDR3 @ 661 MHz Dual Cha...EVGA NVidia GTX 560 1024MB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
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 Computer My Computer

At a glance

Windows 7 Professional 64AMD Phenom II X2 560 (unlocked) 3.3 GHz Black...8 GB Corsair XMS3 DDR3, 4 GB each in banks 1 & 3Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA
Computer 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(s)
Galaxy GeForce 9500GT 512 MB DDR2 DVI+VGA
Sound Card
on-board
Monitor(s) Displays
Dell 15" LCD monitor
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
PSU
500 W CoolerMaster Power Plus
Case
CoolerMaster 690 II Advanced Mid tower
Cooling
4 fans
For me, it asks a question:

xcopy.JPG

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 Computer My Computer

At a glance

W7 Pro SP1 64biti78GBIntel HD Graphics
Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Back
Top