0

I am using cacls to set permissions on files and folders in a batch file.

Cacls c:\program1 /e /g joebloggs:f >>c:\users\desktop\script-log.txt 2>&1

Crazy thing is it works sometimes and not others.

The output of the command is redirected to a text file and it shows "processed c:\program1"

But when I go to double check the result, the user joebloggs is not in the acls list (Security tab).

I have tried this on an identical machine with the same image and then it works sometimes!

It has to work every time.

Anyone know why this occurs?

Mofi
  • 46,139
  • 17
  • 80
  • 143
Confuseis
  • 131
  • 3
  • 13
  • Do you run it with elevated permissions? – foxidrive Oct 25 '14 at 13:09
  • Yes it runs under a domain admin account – Confuseis Oct 25 '14 at 15:24
  • cacls was replaced a decade ago by icacls. cacls is for old scripts to use. You should be using icacls. Errors will go to the screen while overall status will be redirected. Place `2>&1` at end of command line (or beginning). This redirects StdError to whereever StdOut is. Your file will now have the error message as well. Also use icacls to check permissions `icacls c:\program1`. – triggeradeadcat Oct 26 '14 at 17:57

0 Answers0