In Windows Vista, how can I take ownership of a file from the command line?

John Savill

May 8, 2007

1 Min Read
ITPro Today logo in a gray background | ITPro Today

 

A. Vista retains the Takeown command, which lets you take ownership of a file. A number of switches (e.g., /s) let you specify a remote system, along with the user context to use (e.g., /u and /p for username and password). Here's some sample usage for taking ownership of a specific file:

takeown /f intlcfg.exe
SUCCESS: The file (or folder): "D:Tempintlcfg.exe" now owned by user "SAVILLTECHjohn"

To take ownership of a folder and all its content, you can add the /r switch for recursive execution:

takeown /f . /r
SUCCESS: The file (or folder): "D:Temp" now owned by user "SAVILLTECHjohn"
SUCCESS: The file (or folder): "D:Tempboot.wim" now owned by user "SAVILLTECHjohn"

You can also use the /a switch to make the ownership go to the Administrators group instead of the current user:

takeown /f intlcfg.exe /a
SUCCESS: The file (or folder): "D:Tempintlcfg.exe" now owned by the administrators group.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like