I created a shared folder on my NAS box that has a folder for each user in it and it mimics their user name. I'm looking to write a .bat that will map the user folders inside to each user by user name. So when they log in they have their folder in the drive area mapped.

not looking to dot he Home group folder path in ADUC because it causes issues with users that have laptops.



The %USERNAME% environment variable is set individually for every logged in user. So in your batch file, you can do:

net use * \\\\server\share\%USERNAME%

This will map the user's named folder to the next available drive letter (assuming they have permissions to the share).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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