In Windows Vista, how can I take ownership of a file from the command line?
May 8, 2007
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
You May Also Like