tags:

views:

11

answers:

0

I would like to ask, how to write a batch script(.bat) to read a text file, then the program will set the specific person to share with specific folder.

For example, the text file "user.txt" contains the following data: 034001,C:\Users\034001 034002,C:\Users\034002 034003,C:\Users\034003 034004,C:\Users\034004

The first column is user name, and the second column is the share folder path. User name and share folder path are delimited by a comma.

Then I have coded part of the script.


for /f %%a in ('C:\user.txt') do (

net share %%a=%cd%\%%a /grant:everyone,full

)


I don't know how to set a user, says 034001, to share with C:\Users\034001.

It is because in the script above, the setting is to grant Everyone to have full permission.

However, I only want 034001 to have full permission with C:\Users\034001 instead of everyone.

So, how to modify the script or does anyone have a batch file that would enable me to modify the permission for all folders in one hit? Really I don't want to do it manually!

Thank you for your kindly help in advance.

related questions