Link to home
Start Free TrialLog in
Avatar of ptnklbg
ptnklbg

asked on

XCOPY in Windows XP

In my office , I use the following command to transfer everything from one harddisk to another (must be bootable) harddisk and the OS is WIN98SE.

   XCOPY C:\*.* /E /C /R /H /Y /K

Shall I use the same command if OS is WinXP. If there are other solutions, please suggest.
ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rigor_mortis
rigor_mortis

i'm not quite sure on this (maybe another expert can back me up on this), but i think it depends on your filesystem wheter or not xcopy will work on a windowx xp system. If your using FAT32 i dont suspect you'll run into any trouble, but if your using NTFS i doubt this will work as the filesystem stores a lot of other information (like security settings for example) and those will be lost (not copied) when you use xcopy, rendering the system unusable.

The best way to copy the complete information of a harddisk or partition using a NT based operating system is to use powerquest (nowadays symantec) drive image or symantec norton ghost (as the previous expert allready pointed out to you)

Check this stuff..............

Xcopy:

Copies files and directories, including subdirectories.

Syntax:

xcopy Source [Destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d[:mm-dd-yyyy]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a|/m}] [/n] [/o] [/x] [/exclude:file1[+[file2]][+[file3]] [{/y|/-y}] [/z]

Parameters:

Source
Required. Specifies the location and names of the files you want to copy. This parameter must include either a drive or a path.
Destination
Specifies the destination of the files you want to copy. This parameter can include a drive letter and colon, a directory name, a file name, or a combination of these.
/w
Displays the following message and waits for your response before starting to copy files:
Press any key to begin copying file(s)

/p
Prompts you to confirm whether you want to create each destination file.
/c
Ignores errors.
/v
Verifies each file as it is written to the destination file to make sure that the destination files are identical to the source files.
/q
Suppresses the display of xcopy messages.
/f
Displays source and destination file names while copying.
/l
Displays a list of files that are to be copied.
/g
Creates decrypted destination files.
/d[:mm-dd-yyyy]
Copies source files changed on or after the specified date only. If you do not include a mm-dd-yyyy value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.
/u
Copies files from Source that exist on Destination only.
/i
If Source is a directory or contains wildcards and Destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether Destination is a file or a directory.
/s
Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory.
/e
Copies all subdirectories, even if they are empty. Use /e with the /s and /t command-line options.
/t
Copies the subdirectory structure (that is, the tree) only, not files. To copy empty directories, you must include the /e command-line option.
/k
Copies files and retains the read-only attribute on destination files if present on the source files. By default, xcopy removes the read-only attribute.
/r
Copies read-only files.
/h
Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files.
/a
Copies only source files that have their archive file attributes set. /a does not modify the archive file attribute of the source file. For information about how to set the archive file attribute by using attrib, see Related Topics.
/m
Copies source files that have their archive file attributes set. Unlike /a, /m turns off archive file attributes in the files that are specified in the source. For information about how to set the archive file attribute by using attrib, see Related Topics.
/n
Creates copies by using the NTFS short file or directory names. /n is required when you copy files or directories from an NTFS volume to a FAT volume or when the FAT file system naming convention (that is, 8.3 characters) is required on the destination file system. The destination file system can be FAT or NTFS.
/o
Copies file ownership and discretionary access control list (DACL) information.
/x
Copies file audit settings and system access control list (SACL) information (implies /o).
/exclude:filename1[+[filename2]][+[filename3]]
Specifies a list of files containing strings.
/y
Suppresses prompting to confirm that you want to overwrite an existing destination file.
/-y
Prompts to confirm that you want to overwrite an existing destination file.
/z
Copies over a network in restartable mode.
/?
Displays help at the command prompt.
Remarks
Using /v
Windows XP does not use this command. It is accepted only for compatibility with MS-DOS files.

Using /exclude
List each string in a separate line in each file. If any of the listed strings match any part of the absolute path of the file to be copied, that file is then excluded from the copying process. For example, if you specify the string "\Obj\", you exclude all files underneath the Obj directory. If you specify the string ".obj", you exclude all files with the .obj extension.

Using /z
If you lose your connection during the copy phase (for example, if the server going offline severs the connection), it resumes after you reestablish the connection. /z also displays the percentage of the copy operation completed for each file.

Using /y in the COPYCMD environment variable
You can use /y in the COPYCMD environment variable. You can override this command by using /-y on the command line. By default, you are prompted to overwrite, unless you run copy from within a batch script.

Copying encrypted files
Copying encrypted files to a volume that does not support EFS results in an error. Decrypt the files first or copy the files to a volume that does support EFS.

Appending files
To append files, specify a single file for destination, but multiple files for source (that is, by using wildcards or file1+file2+file3 format).

Default value for Destination
If you omit Destination, the xcopy command copies the files to the current directory.

Specifying whether Destination is a file or directory
If Destination does not contain an existing directory and does not end with a backslash (\), the following message appears:

Does destination specify a file name
or directory name on the target
(F = file, D = directory)?

Press F if you want the file or files to be copied to a file. Press D if you want the file or files to be copied to a directory.

You can suppress this message by using the /i command-line option, which causes xcopy to assume that the destination is a directory if the source is more than one file or a directory.

Using the xcopy command to set archive attribute for Destination files
The xcopy command creates files with the archive attribute set, whether or not this attribute was set in the source file. For more information about file attributes and attrib, see Related Topics.

Comparing xcopy and diskcopy
If you have a disk that contains files in subdirectories and you want to copy it to a disk that has a different format, use the xcopy command instead of diskcopy. Because the diskcopy command copies disks track by track, your source and destination disks must have the same format. The xcopy command does not have this requirement. Use xcopy unless you need a complete disk image copy.

Exit codes for xcopy
To process exit codes returned by xcopy, use the errorlevel parameter on the if command line in a batch program. For an example of a batch program that processes exit codes using if, see Related Topics. The following table lists each exit code and a description.

Exit code Description
0 Files were copied without error.
1 No files were found to copy.
2 The user pressed CTRL+C to terminate xcopy.
4 Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line.
5 Disk write error occurred.

Examples
To copy all the files and subdirectories (including any empty subdirectories) from drive A to drive B, type:

xcopy a: b: /s /e

To include any system or hidden files in the previous example, add the/h command-line option as follows:

xcopy a: b: /s /e /h

To update files in the \Reports directory with the files in the \Rawdata directory that have changed since December 29, 1993, type:

xcopy \rawdata \reports /d:12-29-1993

To update all the files that exist in \Reports in the previous example, regardless of date, type:

xcopy \rawdata \reports /u

To obtain a list of the files to be copied by the previous command (that is, without actually copying the files), type:

xcopy \rawdata \reports /d:12-29-1993 /l > xcopy.out

The file Xcopy.out lists every file that is to be copied.

To copy the \Customer directory and all subdirectories to the directory \\Public\Address on network drive H:, retain the read-only attribute, and be prompted when a new file is created on H:, type:

xcopy \customer h:\public\address /s /e /k /p

To issue the previous command, ensure that xcopy creates the \Address directory if it does not exist, and suppress the message that appears when you create a new directory, add the /i command-line option as follows:

xcopy \customer h:\public\address /s /e /k /p /i

You can create a batch program to perform xcopy operations and use the batch if command to process the exit code if an error occurs. For example, the following batch program uses replaceable parameters for the xcopy source and destination parameters:

@echo off
rem COPYIT.BAT transfers all files in all subdirectories of
rem the source drive or directory (%1) to the destination

rem drive or directory (%2)

xcopy %1 %2 /s /e

if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit

***********************************************

How can I schedule XCOPY to run in background without any visible windows : -

https://www.experts-exchange.com/questions/20680722/How-can-I-schedule-XCOPY-to-run-in-background-without-any-visible-windows.html


************************************************

Hope, this information helps you.


if you need to clone harddrives your best option will always be symantec's ghost utility...
Agreed.  Symantec ghost is what you want.

side note would xcopy *.*  will not grab files w/o extentions.

I am not a xcopy master, but i would drop the .* and just use XCOPY * .. etc...
Actually, at least with XP's version, I believe xcopy *.* 'will' grab files without extensions. . .
LoL!  your right.   that does not make any sence.  But its microsofts world, they make the rules :)

Is there any benifit to using *.* vs *     ????
I use just * at work to archive laptop users documents to a user drive on the netowork for backup.  I think its working fine.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW when this review was written Acronis TrueImage wasn't able to clone disks. However their newest version can.
Oh just for information sake if I had the money, which I don't I am flat broke and I aint kidding :), I would get Retrospect Professional mentioned that review I posted.
> Shall I use the same command if OS is WinXP.

Answer: Yes.

Xcopy is often preferred by many. You might also check out a (freeware?) called XXcopy if looking for more, but that is not necessary here. But xcopy on its own does this very well. As far as moving command from one OS to another, I shall post below the syntax for XP, which as you can see will cover all the same switches you are used to (just don't go do it between different OS vers:

----------------------------------------------------------------------------------------------------------------------------------------------------

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>help 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]
                           [/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 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.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.

C:\>
CrazyOne> most of them system files preventing xcopy from being able to copy these files. Since you appear to want to clone your disk then xcopy will not do this for you.  

It is really a waste of time IMO to backup the windows directory tree of any OS, and that includes Win98. As CrazyOne mentions, XP has more to it, if you ever get around to trying to restore to HD\Windows. It will get in your way more. But then again, unlike Win98, it will also repair/update itself.

When the need is simply to backup files that change, it is generally considered better just to back up the files that change and leave the OS area alone. So your backup software and programs should focus more on subdirecotries. Either through using a batch file (CMD) with a list of backup (copy) commands, or do it the new improved MS way, always place all of your stuff in their new improved MyDocuments folder, whether it is pictures or music or spreadsheets or game save files or whatever. Then you can still go with single xcopy command to migrate that directory tree from one place to another, and by copying less of the useless (or needless) stuff, if should finish quicker. While I am not willing to try it myself, I think your switches are set up to run to completion despite errors, and as such it should still work as well.
>>>It is really a waste of time IMO to backup the windows directory tree of any OS

I strongly disagree. I despise havinb to fresh or repair install. When the OS is running very good I backup the Windows fodlder using a utility a I built. It has savef my butt on many occasions. I put the backup folder in my boot.in and when needed I can boot to the backup folder to see if the problem is related to the original Boot folder. And if it is then I boot the computer to the RC rename the WIndows to Window_ folder and rename the Winback folder to Windows and I am back in busisness in less than 15 mins. This is 7 to 10 times fastes then using System Restore and much more reliable.

In my opinion it is a bit foolish not to have a snapshot of the Windows folder believe me doing what I dscibscribe has saved me countless hours by doing it this way. And in my opinion it is a better method then doing a repair or fresh install overall. I mean with this method you don't have to do a System Resore or Fresh Install. Their opinion's that suggest one should fresh install so often to get rid of this or that and supposesly better performance. If one maintains their machine this totally fresh install is very uncecessary. I have yet see a fresh install to be any better than the method I use. To me a fresh insall is useless in comparison unless one is left with no choce but to fresh insall. I absolutly applaud what ptnklbg is wanting to do. Cloning or imaging or backing up the Widows directoy is the appropriate thing to do. So kudos to ptnklbg for being wise enough to fo this.

I also I do full system clone, and I am readin that is what the quesiton want do. so if the current disk takes a nose dive I have another at the ready to plug in and be back in business within 5 mins. Again I think people who don't image or clone are just kidding them selve. What sane person wants to reinstall from scatch when there is abolutel no reason to fo so. Plus if you use xcopy it doesn write to the boot sector but the cloning/imaging programs do. So for cloning the disk xcopy doesn't accomplish what is need in XP. And xcopy is no faster then uing cloning utilities

ANd the questioner stongly suggest that what the want is a full snapshot of the disk. XCOPY WILL NOT DO THIS PERIOD.
Avatar of ptnklbg

ASKER

I will install every software in one hard disk. The OTHER hard disk has been formatted and made bootable earlier. The only work that I do is,  the said XCOPY command, i.e. also in MS-DOS Prompt window only (in other words, win98 is not booted for command prompt).

Most important : Hard disks are of different capacities.
File system is FAT32 for Window 98.

So this work saves the time to install OS and other software in each system.  After this, from 2 to 4, 4 to 8, 8 to 16 systems ....

So what about in WINXP, if Hard disks are of different capacities, and File system is NTFS
I doubt Xcopying your files from a ntfs partition to a fat32 partition and then trying to run windows xp from that fat32 will run smoothly. Being installed and configured on the NTFS partition at first windows xp will expect and configure around the extra possibilities it has on a NTFS volume. When you suddenly change that environment to a FAT32 setting i doubt windows xp will be able to reconfigure itself again to let everything run smoothly again. I have no experience to back this up, i havent tested it myself, but having a bit of experience in this field i still strongly disencourage you to use a Xcopy method to create an easily accessible back-up of a system running windows xp.
Just use one of the backup clone/imagaging utilites mentioned. They will backup clone or image any and all partition. liked I said XCOPY WILL NOT backup all, especailly the critical XP files regardless which file system is in use you need a third party utility to do this.
Avatar of ptnklbg

ASKER

Both Hard disks ie source & target (in other words, both master and slave hard disk) formatted for ntfs only
i'm still a bit reluctant on the issue of xcopy copying all the necessary security information, but if my estimed colleagues are correct you shouldn't have any problems then...
xcopy will retain the security info going for NTFS to NTFS. But like I said there are critical system files that this OS locks down and xcopy is unable to copy these files.

BTW I tried the new Acronis TrueImage to clone with. And I was impressed with it. It did the clone in about half the time Ghost takes to clone. It suprised me how fast this utility did the cloning.
You might want to have a look at www.back4win.com, it's a freeware tool that incorporates almost the complete functionality that ghost or drive image have to offer
hm