Page 1 of 1

Taking Ownership of a File or Folder from the Command Line

Posted: Wed Jan 20, 2021 4:08 pm
by RescuePC
Taking Ownership of a File or Folder from the Command Line, then add group users to all files

To take ownership of a file, run the command:

takeown /F <filename>
In this command, you must replace <filename> with the full file system path to the file you want to take ownership of or relative path .\filename. If the command is successful, you'll see a message similar to the following: SUCCESS: The file (or folder): "filename" now owned by user "Computer Name\User name".

To take ownership of a folder, use the command:

takeown /f <foldername> /r /d y

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

takeown /?

then add user to all files

icacls .\* /q /c /t /grant Users:F