To take ownership and grant full permission of a file:
takeown /f filename
icacls filename /grant administrators:F
To take ownership and grant full permission of a folder:
takeown /f foldername /r /d y
icacls foldername /grant administrators:F /t
恢复原有权限
icacls * /T /Q /C /RESET
赋予某个用户权限
icacls * /T /Q /C /grant 用户名:F
http://www.askvg.com/add-take-ownership-option-in-file-folder-context-menu-in-windows-vista/
http://www.askvg.com/guide-how-to-restore-trustedinstaller-as-default-owner-of-a-file-or-folder-in-windows/
http://technet.microsoft.com/en-us/library/cc753525.aspx