icacls d:\ /setowner %username% /t

icacls d:\ /grant:r %username%:(oi)(ci)m /t

the /t is only necessary if inheritance is disabled somewhere.
to re-enable inheritance:
icacls d:\ /reset /t
the :r tells to replace all old permissions instead of adding the new ones.
use f instead of m for full access, rx for readonly.
you can set several acls at once:
icacls d:\ /grant:r system:(oi)(ci)f admin:(oi)(ci)f user:(ci)(oi)m 
guest:(oi)(ci)rx

-- 
Message sent from a mobile device, please excuse brevity and typos

Reply via email to