21

I'm trying to replace notepad.exe with notepad2.exe, but I'm getting UAC permission issues when I try to open a file with the replacement notepad2.exe. I have to open notepad2.exe as admin.

How can I perform a Windows 7 equivalent of the linux chmod 777 on the file?

28

Using cacls you can do this same type thing, example.

cacls myfile.txt /g everyone:f
  • Note that explicit deny entries can override this. – Joey Jul 13 '10 at 13:40
  • 2
    Good point, replacing the /g with /p will take care of this. – David Remy Jul 13 '10 at 13:45
  • 3
    Please note that from Windows 7 onwards cacls is considered deprecated by Microsoft and icacls should be used instead. – Giles Roberts Jan 17 '13 at 15:07
  • 1
    What is cacls? -1 for not giving any infos or providing a link to the page. – Black Mar 6 '17 at 10:36
19

Roughly:

icacls notepad.exe /grant Everyone:F

Note that this isn't exactly the same as deny ACL entries override allow entries, so if there are any deny ones you may need to remove them.

Generally, I honestly have to question the motives of what you are attempting to do. There should never be a reason to replace core operating system files with other ones.

You can easily associate text files with Notepad2 without replacing notepad.exe which should be the preferred way of dealing with this.

  • This still works great in Windows 10. At risk of stating the obvious, make sure you're logged in as a user with the required privileges (usually owner or admin). Easiest method is simply starting an admin console, usage at your own risk. I wouldn't recommend replacing core system files, but every once in a while your OS will decide you're not allowed access to a folder you really want access to. This command works on folders as well. – user366447 Mar 9 '16 at 12:12
3

You can change the permissions from the command line via this information, although I personally find that the GUI permission controls are pretty easy to understand.

You can use it 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: R - Read W - Write C - Change (write) F - Full control
  • 1
    CACLS is deprecated. Microsoft recommends using ICACLS instead. – ctype.h Jan 16 '12 at 23:21
3

This may work, tailor your command line as needed:

Step 1 - Open cmd window with admin privileges

Step 2 - to take ownership of contents of "picts" directory

     takeown /f C:\picts\* /r

Step 3 - to change permissions to "everyone" of contents of "picts" directory

     icacls C:\picts /grant Everyone:F /t
1

Alternatively, you could install a free Windows terminal program like MobaXterm. When you open it you will see it gives you access to your local Windows pc directories but emulates a Linux command-line-interface, offering several Linux commands based on Cygwin such as chmod.

I'm sure there are also other tabbed Windows terminal programs out there that emulate a Linux CLI. I just currently use MobaXterm. I find it useful to keep several tabs going while using the same commands across each: one for my remote Linux server, one for a VirtualBox Linux server, and one for my local Windows pc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.