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
Pooua

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
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

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
MilesAhead

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
Pooua

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
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

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
Pooua

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
Golden
Microsoft MVP

Windows 7 Ult. x64
 
 

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
Pooua

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
UsernameIssues

W7 Pro SP1 64bit
 
 

For me, it asks a question:

Name:  xcopy.JPG
Views: 355
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
Thread Forum
meaning of AM and PM
is it true that AM stands for after morning and PM stands for prime time
Chillout Room
xcopy comes up with 'file not found'
I am just trying to get this simple script i wrote to work in a batch file, but when I run the file, in the cmd screen, it comes up with; File not found- Backup 0 file(s) copied This is the script I use; @Echo Off xcopy /s "c:\Users\Jacob Smith\Desktop\Server\world d:\Users\Jacob...
General Discussion
Xcopy cannot create directory
My backup cmd file has been in use since XP, through Vista to Win7. It has worked on a new laptop in Win7 ever since Win7 was released. Recently it has stopped working getting an access denied, cannot create directory message. It is xcopying my own folders, not the default documents etc. In a cmd...
General Discussion
WBADMIN - command line parameters
Hi, WBADMIN command line parameters provides a possibility to create batch files running advanced, automated backup. But, I need a scheduled task for backup of the entire system image. It seems this is not possible, and that the only way to create a system image backup is by using the GUI?...
Performance & Maintenance
Need xcopy script help
I'm looking for a script that will allow me to copy and "overwrite" all files with a date and time stamp BEFORE a certain date. The source files will NOT be deleted and all permissions will stay the same in destination directories. Copy does include subfolders as well. Any ideas?
General Discussion
Game command line parameters
I simply want to add the -nointro parameter to my BioShock game shortcut. I go to the shortcut, then properties, but where I think it should be added, similar to what XP looks like, is greyed out (the word "BioShock"). What do I need to do? I'm new to Windows 7, coming from XP. Thanks, ...
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 08:33.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App