Friday, March 19, 2010

CACLS in a Batch File

I was working with permissions in a directory and remembered the command CACLS to change permissions. I needed this in a script but it ran and prompted the user for a "Y or N". This would not be good since I inteded to run the script on a scheduled task and there would be no one to press Y or N when the script ran. There is not a "/Y" option for CACLS, which would normally automatically answer "Y". Instead you have to run the command like so: " echo y| cacls folder /g everyone:F ". The spacing is important because with a space after the Y it would cause CACLS to fail (CACLS is apperently looking for just "Y" and not "Y+(space)".

No comments:

Popular Posts