ファイルの所有権の取得
takeown
- C:\Windows\system32\takeown.exe /?
Output:
TAKEOWN [/S システム [/U ユーザー名 [/P [パスワード]]]]
/F ファイル名 [/A] [/R [/D プロンプト]]
説明:
このツールを使うと、ファイルの所有権を割り当て直して、前回アクセスが拒否
されたファイルへのアクセスを管理者が回復できるようにします。
パラメーター一覧:
/S システム 接続先のリモート システムを指定
します。
/U [ドメイン\]ユーザー コマンドを実行するユーザー
コンテキストを指定します。
/P [パスワード] 指定のユーザー コンテキストのパスワード
を指定します。
省略すると入力が促されます。
/F ファイル名 ファイル名またはディレクトリ名のパターンを
指定します。ワイルドカード "*" を使って
パターンを指定できます。
'共有名\ファイル名' も使用できます。
/A 現在のユーザーではなく、管理者に所有権を
与えます。
/R 再帰: 指定されたディレクトリとすべてのサブ
ディレクトリにあるファイルに対してツールを
実行します。
/D プロンプト ユーザーがディレクトリに対し "フォルダーの一覧"
アクセス許可を持っていない場合、既定の答えが
使用されます。これはサブディレクトリに対し 再帰的(/R) に操作を行っている場合に適用され
ます。有効な値は "Y" (所有権を得る)、および "N" (スキップ) です。
/SKIPSL シンボリック リンクに接続しません。
/R と同時には指定できません。
/? このヘルプを表示します。
注意: 1) /A が指定されていない場合は、ファイルの所有権は現在
ログインしているユーザーに与えられます。
2) "?" や "*" を使った混合パターンはサポートされていません。
3) /D を使うと、確認プロンプトは表示されません。
例:
TAKEOWN /?
TAKEOWN /F lostfile
TAKEOWN /F \\system\share\lostfile /A
TAKEOWN /F directory /R /D N
TAKEOWN /F directory /R /A
TAKEOWN /F *
TAKEOWN /F C:\Windows\System32\acme.exe
TAKEOWN /F %windir%\*.txt
TAKEOWN /S システム /F MyShare\Acme*.doc
TAKEOWN /S システム /U ユーザー /F MyShare\MyBinary.dll
TAKEOWN /S システム /U ドメイン\ユーザー /P パスワード /F share\ファイル名
TAKEOWN /S システム /U ユーザー /P パスワード /F Doc\Report.doc /A
TAKEOWN /S システム /U ユーザー /P パスワード /F Myshare\*
TAKEOWN /S システム /U ユーザー /P パスワード /F Home\Logon /R
TAKEOWN /S システム /U ユーザー /P パスワード /F Myshare\directory /R /A
TAKEOWN [/S system [/U username [/P [password]]]]
/F filename [/A] [/R [/D prompt]]
Description:
This tool allows an administrator to recover access to a file that
was denied by re-assigning file ownership.
Parameter List:
/S system Specifies the remote system to
connect to.
/U [domain\]user Specifies the user context under
which the command should execute.
/P [password] Specifies the password for the
given user context.
Prompts for input if omitted.
/F filename Specifies the filename or directory
name pattern. Wildcard "*" can be used
to specify the pattern. Allows
sharename\filename.
/A Gives ownership to the administrators
group instead of the current user.
/R Recurse: instructs tool to operate on
files in specified directory and all
subdirectories.
/D prompt Default answer used when the current user
does not have the "list folder" permission
on a directory. This occurs while operating
recursively (/R) on sub-directories. Valid
values "Y" to take ownership or "N" to skip.
/SKIPSL Do not follow symbolic links.
Only applicable with /R.
/? Displays this help message.
NOTE: 1) If /A is not specified, file ownership will be given to the
current logged on user.
2) Mixed patterns using "?" and "*" are not supported.
3) /D is used to suppress the confirmation prompt.
Examples:
TAKEOWN /?
TAKEOWN /F lostfile
TAKEOWN /F \\system\share\lostfile /A
TAKEOWN /F directory /R /D N
TAKEOWN /F directory /R /A
TAKEOWN /F *
TAKEOWN /F C:\Windows\System32\acme.exe
TAKEOWN /F %windir%\*.txt
TAKEOWN /S system /F MyShare\Acme*.doc
TAKEOWN /S system /U user /F MyShare\MyBinary.dll
TAKEOWN /S system /U domain\user /P password /F share\filename
TAKEOWN /S system /U user /P password /F Doc\Report.doc /A
TAKEOWN /S system /U user /P password /F Myshare\*
TAKEOWN /S system /U user /P password /F Home\Logon /R
TAKEOWN /S system /U user /P password /F Myshare\directory /R /A
Return Code: 0
C:\Windows\system32\takeown.exe
c:\>ver
Microsoft Windows [Version 10.0.19045.2075]
| File | Info |
|---|---|
| File Size | 66560bytes |
| Creation Time | 2019/12/07 18:09:51 |
| LastWrite Time | 2019/12/07 18:09:51 |
| ProductVersion | 10.0.19041.1889 |
| FileVersion | 10.0.19041.1889 (WinBuild.160101.0800) |
| Hash | Value |
|---|---|
| MD5 | d258a76aa885cbbcae8c720cd1c284a5 |
| SHA1 | 85a080da6c5a908c4c5973bf429d63b975b85109 |
| SHA224 | 06734bea9598d76a270db260bf4743e964ee03e297fccdc939b952ca |
| SHA256 | 57b3cfa9993e52866a2fb489edf079bf4f1c78fa7525bdf59affa8f9cb4023f8 |
| SHA384 | c3f315a757a2471ff8ef75a6d708104d92ae45f275f91a2af2885bb2224a1a41ce45c903bb97bf2b169894d0be0b931a |
| SHA512 | ffae4a77862dcfa7afc358bfa72183a3de1741215878fbc476c65fb6e4c456b3ceec957e4d7f7a0cf43b2852d5cfe4ae96cb3739c93d63f73f3b6c153cf22d1e |