title: Batch file to copy from all user profiles
body: <p>I want to generate a batch file that will copy all *.doc and *.xls file types from a user's profile.  I will then set the batch file to run automatically via Scheduled Tasks after-hours when all users are logged out.  Here is what I have:</p>
  
  <pre><code>for %%x in (doc xls) do xcopy c:\Users\user1\*.%%x "\\server\i$\User Backups\user1\%computername%\" /c /i /y /s /d
  </code></pre>
  
  <p>This works fine, however, I need to generate a line item in the batch file for each and every user in our organization (user1, user2, etc.) so that I hit all profiles.  When new users are hired, the file needs to be updated with their profile info.  Ideally, I'd like something a bit more automated that is similar to this:</p>
  
  <pre><code>for %%x in (doc xls) do xcopy %userprofile%\*.%%x "\\server\i$\User Backups\%username%\%computername%" /c /i /y /s /d 
  </code></pre>
  
  <p>The downfall is that by using %userprofile% in place of the 'user1' input, it only runs against the currently logged in user.  Is there another option I could incorporate that wouldn't care about the currently logged in user, and instead just run against all user profiles on a machine?</p>