Take ownership of a file or directory from the command line in Windows.

:: To take ownership of the specified file:
takeown /f <path/to/file>

:: To take ownership of the specified directory:
takeown /d <path/to/directory>

:: To take ownership of the specified directory and all subdirectories:
takeown /r /d <path/to/directory>

:: To change ownership to the Administrator group instead of the current user:
takeown /a /f <path/to/file>