I too am scripting, a long time user of cacls, but confused as heck with icacls. They just got everything wrong with the docs: too much no one needs to do, and nothing you would need to do; I found many thing are undefined in docs: container, objects, sid, perm. They didn't take a single week to make the docs easier, while a billion people over the years will be lost at using this useful tool, over looking its power.
I also have no windows7 machine to test my icacl bat So I don't know if there are y/n confirmations I need to overcome or what will work.
I am distributing an few exes that do not need to extract on the fly anything. so I will be putting these exes in folder called toolbox that will not allow any file to be written to the folder toolbox.
Do any of these lines work? Which can I use to lock for everyone, every account?
title icaclsbat
%SystemRoot%\system32\icacls.exe toolbox /grant:r Administrators:(OI)(CI)R
%SystemRoot%\system32\icacls.exe toolbox /grant:r users(OI)(CI):R
%SystemRoot%\system32\icacls.exe toolbox /grant:r system(OI)(CI):R
cd toolbox
%SystemRoot%\system32\icacls.exe * /T /C /grant:r system:(OI)(CI)R
: the frowny face is colon left parenthesis.