Batch script to create home home directories from list of names

Posted by Steven on Server Fault See other posts from Server Fault or by Steven
Published on 2013-07-02T21:51:27Z Indexed on 2013/07/02 23:08 UTC
Read the original article Hit count: 183

Filed under:
|

I'm trying to create a home directories with permissions from a text file. I can only get the batch file to run the first line. Can anyone tell me why?

I initiate the scripts by running go.bat as administrator.

go.bat

@echo
for /f %%a in (users1.txt) do call test.bat %%a

test.bat

@echo off
m:
cd \
mkdir %1
icacls %1 /grant %1:(OI)(CI)M 

cd %1

mkdir public
icacls public /inheritance:d
icacls public / All:(OI)(CI)(RD)
icacls public /grant All:(OI)(CI)R

mkdir private
icacls private /inheritance:d
icacls private /remove All

cd \

users1.txt

user1
user2
user3

© Server Fault or respective owner

Related posts about scripting

Related posts about batch