command line/batch file

  • Hi,

    I have a batch file - wherein i am creating a directory (eg: md "C:\Test").

    I want to set permission for this directory.

    Through windows - i can just right click the test folder and click on permission - and set the full control, read, write, etc for users like administrators, user etc.

    I want to do this (similar to the windows way) through my batch file itself - for the newly created folder.

    How to go about it. Plz plz let me know.

    Thanks.

     

  • Natalie.

    Here is a link on how to do it in VBscript using WMI objects. This link has a code example and links to other code examples. Incidentally the name of the example test folder is "C:\TestFolder" almost as in your question. The example in the article just reads the folder permissions, but another method in this article sets these permissions. I am not sure how to implement it in DOS, but with Windows 2003 we now have WMIC utility wich stays for WMI -Console. This utility works with the same WMI classes, but from the command line. Did you try to use Xcacls.exe ?

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/setsecuritydescriptor_method_in_class_win32_logicalfilesecuritysetting.asp

    SetSecurityDescriptor Method of the Win32_LogicalFileSecuritySetting Class

    another article to create DACL by Win API:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secbp/security/creating_a_dacl.asp

     

    Regards,Yelena Varsha

  • If you want to get it all done in a batch file, check out xcacls.

    http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/xcacls-o.asp

    You want to make sure you have the most recent version.....I believe this is it, but I'd recommend checking around to be sure.

    Let me know if you have any ?'s about it.

  • Hi,

    Sorry i am still having trouble in getting my xcacls to work.

    Should the xcacls.vbs be download into a specific path....?

    I downloaded the xcalcs.vbs into this path: C:\Documents and Settings\UN\My Documents\Test\New Folder

    And i have a folder in C:\Documents and Settings\UN\My Documents\testperm

    in my command prompt: when i type in

    cscript.exe xcacls.vbs /?  

    I get the syntax of the xcacls.

    Then i tried in command prompt (C:\Documents and Settings\UN\My Documents\Test\New Folder) - typed xcalcs.vbs C:\Documents and Settings\UN\My Documents\testperm

    It displays the following msg:

    'xcacls.vbs' is not recognized as an internal or external command, operable program or batch file.

    Why do i get this message....?How to fix this and get it to display me the folder permissions. The sys is windows xp Professional version 2002 SP 2.

    Thnx.

     

     

  • ooops, you want the xcacls.exe. I've got it in my support tools folder, so i'm wondering if it isn't in the XP or 2003 support tools pack. You can call the .exe straight from the command line w/out using the vb interpreter. That should work much better for you.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply