paulmarsh
asked on
Batch file copy to multiple folders
I need to copy a Default User profile directory to all users home directory. There are nearly 2000 users listed in nt user manager. I want to copy from c:\profile\default user to \\server\%username%\
Is there a way of including a variable that will equal the name of the users home directory in a batch file? Or is there an easier way?
Is there a way of including a variable that will equal the name of the users home directory in a batch file? Or is there an easier way?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Most things like this get run through login scripts, and leave room for contention (in use) and timespan to get all of them. With that many users, I wonder also on confidence level of them even using a login script, or if many simply access a shared file and do not need to process that script?
You answered your own question pretty much. Use a logon script to execute a copy command.
Script looks like this:
copy c:\<dir>\file.txt \\<servername>\%username%\ file.txt
That's it. This is assuming of course that the user directory is the same as their username. If there are other characters in there (ie $) just put them after the %username% variable.
Hope this helps.
Script looks like this:
copy c:\<dir>\file.txt \\<servername>\%username%\
That's it. This is assuming of course that the user directory is the same as their username. If there are other characters in there (ie $) just put them after the %username% variable.
Hope this helps.
Just read your post c30keith...didn't mean to repeat exactly what you just said!