We help IT Professionals succeed at work.

copy script from userlist

quippee asked
Last Modified: 2010-04-18
Hello experts, I would liek to copy files from the user profiles to another folder where the user has another folder.

for exampple for user lisa

copy c:\profiles\list\*.*   d:\backup\lisa\

for one user is not problem, but i have a a list of users  in  a text file and I was wondering if there is a way to use that list to inser it in the username part. something like this

copy c:\profiles\%username%\*.*  d:\backup\%username%   Where the username is picked from a list and then it moves to the next.

Im sure there is a way. Just that im not an expert :)
Watch Question

IT guy
This one is on us!
(Get your first solution completely free - no credit card required)


Thanks that worked. but I also used powershell. which was a lil better for now.

example to move documents

$a = get-content c:\users.txt
foreach ($i in $a)
{move-item "Z:\profiles\$i\My documents" "z:\profles2\home\$i\"}
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.