Link to home
Start Free TrialLog in
Avatar of uncas1755
uncas1755

asked on

Copy a file/folder from a local DC instead of a specific location

I need to copy a folder with image files from a local DC that users are logging into.

Currently I have it mapped to ONE particular DC in our domain and use a GPO to run this bat file for all workstations. As you can see from the snippet of Batch command below, I use pushd to map to the directory that houses the folder I want to copy directly so that I can then just copy folder1 to a local workstations public pictures folder on Win7x32 systems after a domain login by the user.

see here for the current way I copy the folder:  
      pushd \\dc4\NETLOGON\
          XCOPY folder1  C:\Users\Public\Pictures\folder1  /S /I
      popd


I am trying to use %logonserver% instead of the specific DC to copy the folder so that it will copy the folder from whatever local DC the user has logged into...

see here my attempt to do this:

      pushd \\%logonserver%\NETLOGON\
          XCOPY folder1  C:\Users\Public\Pictures\folder1  /S /I
      popd


This does not work for some reason.  Any ideas would be extremely helpful, ty!
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
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 uncas1755
uncas1755

ASKER

Thanks, that's what I had.