I want to create a batch file that will copy all types of * .doc and * .xls files from a user profile. Then I installed a batch file to run automatically through the scheduled tasks after closing, when all users are logged out. Here is what I have:
for %%x in (doc xls) do xcopy c:\Users\user1\*.%%x "\\server\i$\User Backups\user1\%computername%\" /c /i /y /s /d
This works great, but I need to create a position in the batch file for each user in our organization (user1, user2, etc.) so that I hit all the profiles. When new users are hired, the file must be updated with profile information. Ideally, I would like a little more automated, similar to this:
for %%x in (doc xls) do xcopy %userprofile%\*.%%x "\\server\i$\User Backups\%username%\%computername%" /c /i /y /s /d
The downfall is that using% userprofile% instead of typing 'user1', it only runs against the current user. Is there another option that I could turn on that would not care about the current user login, but instead just work with all the user profiles on the machine?
source
share