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

 

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:\Temp\intlcfg.exe" now owned by user "SAVILLTECH\john"

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 "SAVILLTECH\john"
SUCCESS: The file (or folder): "D:\Temp\boot.wim" now owned by user "SAVILLTECH\john"

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:\Temp\intlcfg.exe" now owned by the administrators group.

TAGS: Windows 8
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish