Menu Close

Taking Ownership of a File or Folder from the Command Line

Taking Ownership of a File or Folder from the Command Line

To take ownership of a folder, use the command:

takeown /f <foldername> /r /d y

In this command, you must replace <foldername> with the full file system path to the folder you want to take ownership of. You need to include the /r switch when you want to also take ownership of all the subfolders and files in the specified folder. You can use the /d switch to specify the default answer the tool should use when it comes across subfolders for which you don’t have List Folder permissions. In this case, the default answer is y (which stands for yes), meaning that the tool will allow you to take ownership of those subfolders, even though you don’t have List Folder permissions.

To get a detailed overview of the Takeown command syntax, run the command:

takeown /?




icacls * /reset /t /c /q 

Reset replaces the existing one with the default list.
/t acts recursively on all files, folders & subfolders
/q doesn’t display any success messages
/c continues with remaining files even in an error occurs.