batch-filecmdhostscacls

failure to edit hosts file permissions


I am attempting to write a batch file for editing the hosts file. I recieve access is denied when I attempt this:

cacls hosts /e /p %username%:w

what should my command look like? I can do it graphically by hand so I know its doable

Thanks in advance


Solution

  • It's possible you may need to also do the following:

    Don't forget you may need to run takeown in context of local administrator for it to work...