Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


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 SpecsSystem Spec
.

27 Aug 2012   #2

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64 Ubuntu 12.04 LTS Tri-Boot
 
 

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 SpecsSystem Spec
27 Aug 2012   #3

Windows 7 32 bit
 
 

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 SpecsSystem Spec
.


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 SpecsSystem Spec
27 Aug 2012   #5

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64 Ubuntu 12.04 LTS Tri-Boot
 
 

Quote   Quote: Originally Posted by Pooua View Post
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 SpecsSystem Spec
28 Aug 2012   #6

Windows 7 Professional 64
 
 

Quote   Quote: Originally Posted by Golden View Post
Quote   Quote: Originally Posted by Pooua View Post
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 SpecsSystem Spec
28 Aug 2012   #7

Microsoft Community Contributor Award Recipient

Windows 7 Ult. x64 Windows 8.1 x64 Ubuntu 12.04 LTS Tri-Boot
 
 

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 SpecsSystem Spec
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 SpecsSystem Spec
28 Aug 2012   #9

W7 Pro SP1 64bit
 
 

For me, it asks a question:

Name:  xcopy.JPG
Views: 345
Size:  18.6 KB

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 SpecsSystem Spec
Reply

 Meaning of Parameters in the XCOPY command




Thread Tools



Similar help and support threads for2: Meaning of Parameters in the XCOPY command
Thread Forum
Solved meaning of this message... General Discussion
Disk Not Initialized Msg. Meaning Of ? General Discussion
What is meaning of Min/Max CPU in Power settings? Performance & Maintenance
Windows 7 Start Menu Search - pass command line parameters to program General Discussion
WBADMIN - command line parameters Performance & Maintenance
New command-line parameters for Defrag.exe Performance & Maintenance
Game command line parameters Gaming

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 05:45 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33