Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm updating a file in every user profile. The location is fairly deep \profiles\\appdata\roaming\microsoft\imagelogo.jpg and I'm replacing it with a newer file of the same name. I would like to do this for all profiles. Is there a good way to replace all files based on filename?

share|improve this question
up vote 1 down vote accepted

A way of doing this in one swoop would be as follows:

cd path\to\user\profiles
for /d %i in (*) do copy /y newimagelogo.jpg %1\appdata\roaming\microsoft

Despite this, I'd use with Judaslscariot's answer for the following reason:

If a user is logged on when you run this, the image currently in that user's roaming profile will overwrite the image you've just copied, when they log off.

share|improve this answer
Thanks. I was looking to avoid using a login script. Your method worked. The profile sync will work as intended so long as the modified date is newer. – Ryan Jan 24 '12 at 18:34

Create a simple batch script (.bat) to copy the file from a central share to the current users profile:

dir \\centralfileserver\path\imagelogo.jpg
if errorlevel = 1 goto exit
xcopy \\centralfileserver\path\imagelogo.jpg %USERPROFILE%\appdata\roaming\microsoft\imagelogo.jpg

Assign it as a logon script for all users via Group Policy

share|improve this answer
Copying files with the logonscript tends to increase the logontime. Also no errorhandling! Example: What happens when "centralfileserver" is not available? – Tom Jan 24 '12 at 9:39
Nothing. Use ERRORLEVEL if you want error handling – Mathias R. Jessen Jan 24 '12 at 16:38
Added a little error handling for the pleasure of @Tom ;) – Mathias R. Jessen Jan 24 '12 at 17:26
if exist \\centralfileserver\path\imagelogo.jpg xcopy... should also work. – Bryan Jan 24 '12 at 20:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.