Re: Command Line / Batch File set permissions for folders / files

From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 09/11/04


Date: Sat, 11 Sep 2004 01:24:26 +0200

Alex wrote:

> How Do I set/change permissions on Folders or Files using
> the Command Line (or in a batch file)?
>
> (I am creating a batch file to automate some stuff and
> after creating a directory, I need to uncheck the inherit
> from parent, add one user with Modify rights and remove
> Everyone)
Hi

Some options for you:

1)
I don't know but cacls.exe (comes builtin with WinXP), or xcacls.exe
(in WinXP Support Tools) might be able to do this.

HOW TO: Use Xcacls.exe to Modify NTFS Permissions
http://support.microsoft.com/default.aspx?scid=kb;en-us;318754

Windows XP Service Pack 2 Support Tools
http://www.microsoft.com/downloads/details.aspx?FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38

Xcacls.exe have some issues:

Child objects in a folder do not inherit permissions as expected
when you use Xcacls.exe with the /E switch
http://support.microsoft.com/default.aspx?scid=KB;EN-US;822790

2)
I'm pretty sure xcacls.vbs is able to to it:

Download details: Extended Change Access Control List Tool (Xcacls)
http://www.microsoft.com/downloads/details.aspx?familyid=0ad33a24-0616-473c-b103-c35bc2820bda&displaylang=en

3)
FILEACL.exe should be able to do it:

FILEACL.exe - NTFS Permissions command line tool
http://www.microsoft.com/downloads/details.aspx?FamilyID=723f64ea-34f0-4e6d-9a72-004d35de4e64&DisplayLang=en

4)
I know that SetACL.exe can do it:

SetACL.exe (freeware)
http://setacl.sourceforge.net/

-- 
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx


Relevant Pages

  • Re: script to stop a process
    ... Here is a couple of command line utilities: ... Kill.exe is in the Win2k Support Tools found on the Win2k CD, ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)
  • Re: set environment variables through batch files
    ... > is there a way that I can set an environment variable throught a batch file ... For WinXP yo it is included as a utility in the support tools installation ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windowsxp.general)
  • Re: Can I kill a process using script?
    ... the microsoft command line tool kill.exe. ... Kill.exe is in the Win2k Support Tools found on the Win2k CD, ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.scripting)
  • Re: Robocopy - not providing destination in log output
    ... command line tool to be a part of that. ... working script (Batch file) servicing a large ... People who post questions in a *scripting* newsgroup ... Function pad ...
    (microsoft.public.windows.server.scripting)
  • Re: Running a batch process with minimised window
    ... > screen and disapper after execution. ... Is there a command that I can insert in the ... You can e.g. use a vbscript based batch file launcher for this. ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway ...
    (microsoft.public.win2000.cmdprompt.admin)