Meaning of Parameters in the XCOPY command


  1. Posts : 11
    Windows 7 Professional 64
       #1

    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 Computer


  2. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #2

    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


  3. Posts : 5,092
    Windows 7 32 bit
       #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 Computer


  4. Posts : 11
    Windows 7 Professional 64
    Thread Starter
       #4

    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


  5. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #5

    Pooua said:
    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 Computer


  6. Posts : 11
    Windows 7 Professional 64
    Thread Starter
       #6

    Golden said:
    Pooua said:
    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 Computer


  7. Posts : 19,383
    Windows 10 Pro x64 ; Xubuntu x64
       #7

    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


  8. Posts : 11
    Windows 7 Professional 64
    Thread Starter
       #8

    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


  9. Posts : 10,485
    W7 Pro SP1 64bit
       #9

    For me, it asks a question:

    Meaning of Parameters in the XCOPY command-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


 

  Related Discussions
Our Sites
Site Links
About 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 13:20.
Find Us