Make Directory and sub-folders

April 9, 2009 at 13:34:56
Specs: Windows XP

I have a list of about 90 users that work in my building.

I was thinking about using DOS commands to create a directory for each user and two directories below each user's directory.

For example:

md <mapped drive>\<folder_1>\<folder_2>\<username>

md <mapped drive>\<folder_1>\<folder_2>\<username>\<sub-folder1>

md <mapped drive>\<folder_1>\<folder_2>\<username>\<sub-folder2>

I know there has to be an easier way to do this without having to create three commands for each user.

Does anyone know how I could simply have a batch file reference a generic .txt file full of user names?

Comments and Questions welcome.


See More: Make Directory and sub-folders

Report •

April 9, 2009 at 13:48:05
@echo off & setLocal EnableDelayedExpansion

for /f "tokens=* delims=" %%a in (userlist) do (
md <mapped drive>\<folder_1>\<folder_2>\%%a\<sub-folder1>
md <mapped drive>\<folder_1>\<folder_2>\%%a\<sub-folder2>

If at first you don't succeed, you're about average.


Report •

April 9, 2009 at 14:04:52
at the beginning of the batch you should map the drive and then at the end unmap it.

Your "mapped drive" should not be to
mapped drive\folder1\folder2\username but just to folder2.

Then you have to give each user ownership of their home folder as you deny all other users.

last but not least there is no dos in ntldr based os's. There is a cmd shell.

Report •

April 10, 2009 at 12:44:51
Thanks you for the tips. Do you know of a way to grant permissions from the batch file?

I want to give each user full control of their folder, and give full control to SYSTEM and Domain Admins.

Report •

Related Solutions

April 10, 2009 at 16:00:26
"Do you know of a way to grant permissions from the batch file?"

Look in to the command cacls or xcacls depending on what is available on your machine.

Report •

Ask Question