xcopy command will work in a batch file in Windows XP, but not in Windows 7 RRS feed

  • Question

  • I have the following xcopy command which runs perfectly under Windows XP, but will not work properly under Windows 7 Pro.

    xcopy "c:\Data Files\Dave's Data\*.*"   "m:\Dave's Data"   /R/D /E/H

    The batch file command runs perfectly the very first time - when the destination (m:\Dave's Data) is empty.  However, when the batch file is run the second time, the destination directory tree has been created and exists.  While it works in subsequent runs in Windows XP, it does not in Win 7 Pro.  I do not understand what xcopy is doing, but it seems to be trying to recreate (at least on a temporary basis) the destination directory tree on m:\Dave's Data   When the destination directory exists on m:\Dave's Data, the xcopy command fails in Windows 7.

    I have a cmd.exe icon on my Windows 7 desktop set to run with administrator privileges.  I am the only user on the pc and have administrator privileges.  I have found that if I type the xcopy command exactly into the cmd.exe window (no batch file), the xcopy command runs perfectly the first time and all subsequent times on Windows 7.

    This leads me to believe that in Windows 7, there is an issue with administrator privileges when executing the xcopy command within a batch file.

    I'd appreciate any suggestions to get xcopy working in Windows 7.
    • Moved by Bill_Stewart Wednesday, December 12, 2018 6:19 PM This is not system utility support forum
    Friday, August 10, 2018 8:13 PM

All replies

  • Unfortunately this is not  scripting question.   It is a system utilities question.  You should post it here: http://answers.microsoft.com

    I also suggest using RoboCopy in Vista and later systems.

    RoboCopy /?


    Friday, August 10, 2018 8:21 PM
  • I ran your xcopy on Windows 7 and had no issues. 

    Note it will fail if files are open.


    Friday, August 10, 2018 8:33 PM
  • Something I found, that is still a little confusing to me, is using the quotations around ONLY the folder name that contains spaces rather than the whole folder path.


    XCOPY C:\"Data Files"\"Dave's Data"\*.* m:\"Dave's Data" /R /D /E /H

    Try it out and let me know if it changes anything.

    Wednesday, August 22, 2018 1:49 PM