none
Using XCOPY with Windows 7 to copy from network locations

    Question

  • We're trying to use XCOPY to copy files/folders from UNC paths on our network to Windows 7 workstations. In XP, we used to be able to run a command, like

    xcopy \\servername\share "C:\program files\program name\" /E /Y

    this would successfully copy files from a network location to the workstation. I realize that the security model has changed in Windows 7 but I'd like to find a way to get this to run as a batch file for automation sake. Does anyone have any suggestions?
    Orange County District Attorney
    Wednesday, February 03, 2010 1:29 AM

Answers

  • use robocopy... it is built into windows 7 and is very powerful... here is a example of the command that i use:

    robocopy x:\ d:\ /E   /r:5 /W:5  /a-:rsah /XO /XD "System Volume Information" "*Recycle*"


    • Proposed as answer by DrX69 Wednesday, February 03, 2010 4:37 AM
    • Marked as answer by Sandy Wood Wednesday, February 03, 2010 4:00 PM
    Wednesday, February 03, 2010 4:37 AM

All replies

  • use robocopy... it is built into windows 7 and is very powerful... here is a example of the command that i use:

    robocopy x:\ d:\ /E   /r:5 /W:5  /a-:rsah /XO /XD "System Volume Information" "*Recycle*"


    • Proposed as answer by DrX69 Wednesday, February 03, 2010 4:37 AM
    • Marked as answer by Sandy Wood Wednesday, February 03, 2010 4:00 PM
    Wednesday, February 03, 2010 4:37 AM
  • Run the batch file from an elevated command prompt.


    Kerry Brown MS-MVP - Windows Desktop Experience
    Wednesday, February 03, 2010 4:48 AM
  • I can drag and drop or even copy from within Windows Explorer, that works. However, from the workstation with a cmd prompt (elevated or not) XCOPY just doesn't work. I'll give Robocopy a try and see if can copy files from a network UNC instead.

    Thanks for the suggestions!
    Orange County District Attorney
    Wednesday, February 03, 2010 2:43 PM
  • This doesn't work for me either.
    Orange County District Attorney
    Wednesday, February 03, 2010 2:44 PM
  • If it doesn't work from an elevated command prompt then the account you are using does not have the needed NTFS permisssions for the folder you are copying to or from. Check the permissions.

    Kerry Brown MS-MVP - Windows Desktop Experience
    Wednesday, February 03, 2010 3:04 PM
  • The funny thing is, I'm logged in with an account that has Domain Admin permssions. I can copy the folder using Windows Explorer and run the batch file on the local system without a problem. If I open a cmd prompt (regular or elevated) and run the batch file from the network share, xcopy reports that it cannot find the files. Perhaps the batch file is not running under my logged-in credentials when running at the file share?


    Orange County District Attorney
    Wednesday, February 03, 2010 3:09 PM
  • We're using xcopy to help install an old legacy program. We first xcopy the files from a network share to a folder on the user's system under C:\program files and then immediately after that we run a .reg file and then finally run a .vbs file that creates a shortcut on the user system. Yes, it is a bit clunky but it's been working. Now that we're moving into Windows 7, we see that the security model seems to have changed so we're trying to work around it somehow.
    Orange County District Attorney
    Wednesday, February 03, 2010 3:11 PM
  • I was able to get ROBOCOPY to do the trick for me. Even using a normal cmd prompt. I'm running a batch file from a cmd prompt that looks like

    \\server\share\directory\batch.cmd

    It kicks off this on the local machine


    robocopy \\server\share\directory" "C:\program files (x86)\program" /E /IS

    It screams through and copies everything I need.
    Orange County District Attorney
    Wednesday, February 03, 2010 3:52 PM
  • Vegan,

    It is a bit presumptuous to assume that everyone is a developer.  A truly large percentage of companies actually purchase software from other companies.  Gee, that is what creates a demand for software developers!  To assume that everyone asking a question has it within their power to force another company to upgrade to an MSI is ridiculous.

    Thursday, June 24, 2010 4:47 PM
  • windows 7 also uses BAT as a file extension for batch files
    Monday, January 03, 2011 1:49 AM
  • I know this was awhile ago and you've probably worked around this but -- share the directory that you want to have access to (\\servername\share in your example) and then on the workstation: map the a network drive to that location (Win7 has a Menu Bar, but it will be hidden. You have to press ALT button in the Explorer and then do Map Network Drive) -- so if you map it to T: for example then instead of:

    xcopy \\servername\share "C:\program files\program name\" /E /Y

    you would do:

    xcopy T:\ "C:\program files\program name\" /E /Y

    and that should work.

     

    Wednesday, August 10, 2011 4:29 PM