We help IT Professionals succeed at work.
Get Started

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

Last Modified: 2015-04-22
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

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

This does not work for some reason.  Any ideas would be extremely helpful, ty!
Watch Question
End-user support
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE