+ Post New Thread
Results 1 to 2 of 2
Windows Thread, Modify Share Folder Permission in Technical; I would like to ask, how to write a batch script(.bat) to read a text file, then the program will ...
  1. #1

    Join Date
    Aug 2010
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Modify Share Folder Permission

    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.

  2. #2

    RabbieBurns's Avatar
    Join Date
    Apr 2008
    Location
    Sydney
    Posts
    5,521
    Thank Post
    1,333
    Thanked 469 Times in 306 Posts
    Blog Entries
    6
    Rep Power
    199

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 12
    Last Post: 22nd December 2011, 04:39 AM
  2. Profile & Share Permission Problems:(
    By Athlona in forum Windows Server 2000/2003
    Replies: 4
    Last Post: 24th April 2010, 05:38 AM
  3. Permission on a folder
    By Chuckster in forum Coding
    Replies: 1
    Last Post: 8th October 2009, 02:29 PM
  4. Bulk Modify Share Permissions
    By mitchell1981 in forum Windows
    Replies: 4
    Last Post: 11th July 2007, 12:33 PM
  5. Replies: 15
    Last Post: 12th October 2006, 09:37 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •