Michael Hutter
Michael Hutter

Reputation: 1532

How can I change the owner of a file in Windows (command line)

I am working in Windows with a non-admin-account.
Sometimes I have files which I am not allowed to write. These files are from another user with admin rights which I use to install software.

How can I change the owner of a file inside the command line (cmd)?
In Linux it would be easy with the command chown. Is there a similar command in Windows?

Upvotes: 3

Views: 15594

Answers (1)

Michael Hutter
Michael Hutter

Reputation: 1532

Change the ownership of a file to User "Michael":
icacls file.txt /setowner "Michael"

Change the ownership of a file to the currently logged in user:
takeown /f file.txt

More Details can be found here:
https://www.winhelponline.com/blog/take-ownership-of-file-or-folder/

Upvotes: 5

Related Questions