Changing File and Folder Ownership in Windows 11 for Full Access

Steps to Change Ownership Using CMD:

  1. Open Command Prompt as Administrator (Run as Administrator).
  2. Use the following command to take ownership of a file or folder:
takeown /f “C:\Path\To\Folder” /r /d y
  • takeown: Change the ownership of a file or folder.
  • /f “C:\Path\To\Folder”: Specify the location of the file/folder you want to change.
  • /r: Apply changes to all subfolders and files in them (recursive).
  • /d y: Confirm changes automatically without asking for user input.
  1. After changing ownership, run the following command to grant full access to the Administrator account:
icacls “C:\Path\To\Folder” /grant Administrators:F /t
  • icacls: Commands to manage file/folder permissions.
  • /grant Administrators:F : Provides full access (Full Control) to the Administrator account.
  • /t: Apply changes to all files and subfolders.

3. Using Windows PowerShell to Change Ownership

In addition to CMD, you can also use Windows PowerShell, which is more flexible and often used in system administration automation.

Steps to Change Ownership Using PowerShell:

  1. Open PowerShell as Administrator (Run as Administrator).
  2. Run the following command to take ownership of a file or folder:
takeown /f “C:\Path\To\File”

This command is similar to CMD, but can be used in more complex automation scripts.

  1. After becoming the owner of the file, use the following command to grant full access to the Administrator:
icacls “C:\Path\To\File” /grant Administrators:F

Just like in CMD, this command gives full access to the Administrator account.

Advantages of PowerShell over CMD:

  • It can be used in automation scripts and supports more parameters.
  • It can be combined with other PowerShell cmdlets to manage permissions and file ownership in a more advanced way.
  • It can be used to change the ownership of files on other computers in the network.

Example PowerShell Script to Change Ownership of Multiple Files at Once:

If you want to take ownership of all the files in a specific folder:

Get-ChildItem “C:\Path\To\Folder” -Recurse | ForEach-Object { takeown /f $_.FullName }
  • Get-ChildItem -Recurse : Retrieves all files and subfolders inside a folder.
  • ForEach-Object { takeown /f $_.FullName } : Taking ownership of each file individually.

Conclusion

Changing the ownership of files and folders in Windows 11 is an effective way to solve the problem of blocked access. The ownership feature in Windows aims to maintain the privacy and security of user data. However, in some circumstances, such as after reinstalling the system or deleting a user’s account, this feature can block access to important files. By understanding how ownership works and following this guide, you can easily regain access to previously locked files or folders.

Latest Articles