Change Windows 7 file permissions from command prompt

20

7

How can I change Windows 7 file permissions using the command prompt?

I want to change permissions in program files, but cacls is not working for me.

sam

Posted 2010-12-15T08:01:42.793

Reputation: 809

similar problem has been answered here: http://serverfault.com/a/533848/69330

– Jörg – 2013-08-26T14:57:08.573

Answers

20

cacls is depcriated in Windows 7. You need to use ICACLS instead of cacls.

ICACLS "filename" /grant "Users":F

This command is granting the privileges.

saikanth

Posted 2010-12-15T08:01:42.793

Reputation: 209

7

To change permissions, use an administrator account on that machine to run CACLS. If you have UAC enabled, you may have to elevate the command prompt first by right-clicking on it and choosing "Run as Administrator".

You can use cacls as follows:

CACLS files /e /p {USERNAME}:{PERMISSION}

Where,

* /p : Set new permission
* /e : Edit permission and kept old permission as it is i.e. edit ACL instead of replacing it.
* {USERNAME} : Name of user
* {PERMISSION} : Permission can be:
      o R - Read
      o W - Write
      o C - Change (write)
      o F - Full control

For example, to grant your user account full (F) control to files, you would use the following command (typed in an elevated Windows command prompt):

CACLS files /e /p %USERNAME%:f

Read complete help by typing following command:

cacls /?

Thariama

Posted 2010-12-15T08:01:42.793

Reputation: 762

3

If, for any reason, files have become disassociated with the administrator account in Windows 7, using ICACLS will NOT restore them.

You are forced to manually click EACH file, one at a time, and select Properties > Security tab > Advanced button > Permissions tab > Continue button.

If enabled, approve UAC prompt for Permissions Editor for Files and Folders and Uncheck Include inheritible permissions from thsi object's parent. Click the Remove button when prompted, then re-enable Include inheritible permissions, click OK.

This will restore your accesss to the file.

How can this be accomplished against an entire folder or set of files? Using ICACLS *.* /RESET does not work; it ends in error "Access is denied" for the files in question.

Some User

Posted 2010-12-15T08:01:42.793

Reputation: 31

In think "Some User" information is important. I ended-up in this page looking for a way to fix bad permissions and his/her info was very relevant. But, since "Some User" post does not answer th PO question, this should be a comment or question instead of an answer. – Edenshaw – 2017-07-10T20:31:04.810

3This is not a forum, so if you have a new question, please ask a new question using the big button above. – slhck – 2012-06-10T07:20:12.237

0

take ownership of the folder/files first then you work operations on same.

http://www.faqforge.com/windows/take-ownership-of-a-file-or-folder-by-command-in-windows/

Doc

Posted 2010-12-15T08:01:42.793

Reputation: 1

This is a link-only answer. Please include some of the information from the link in your answer using the built-in > blockquote syntax. – wizzwizz4 – 2017-06-10T09:02:51.180

This answer is about as helpful as "The solution to your problem is here: http://google.com."

– ashleedawg – 2019-06-13T15:28:49.190

-1

you need to run cacls with administrator right in order to change permission in program files...

bubu

Posted 2010-12-15T08:01:42.793

Reputation: 9 283

...and how would a person go about doing that? – ashleedawg – 2019-06-13T15:25:14.303

2how to run cacls as administrator using command itself? – sam – 2010-12-15T09:20:20.203

-1

icacls "File/folder_name" /grant "USER":F /t: will provide full access to the user specified as"USER" to the file or folder specified. The /t allows traversal to its sub-folders and files and provides the permission

Ganin T Joy

Posted 2010-12-15T08:01:42.793

Reputation: 1

iI you ever return to the site, please see [answer]. – ashleedawg – 2019-06-13T15:24:30.603