是否有一个原因,当获得一个目录的所有权时,我得到这个错误?
如果我通过GUI的权限,它工作正常,但如果我尝试从命令行执行,我得到一个错误,我没有权限读取它:
takeown /s someserver /f "r:\redirected\flast\My Documents\Music\" /u domain\user /R
您无权读取目录“\ someserver \ r $ \ redirected \ flast \ My Documents \ My Music”的内容。
谷歌发现这个博客似乎表明,要么你需要添加一个默认的答案( /D [Y|N]
)的问题:
“你没有获得所有权的许可,你想吗?”
/D prompt Suppresses the confirmation prompt that is displayed when the current user does not have the "List Folder" permission on a specified directory, and instead uses the specified default value. Valid values for the /d option are as follows: Y: Take ownership of the directory. N: Skip the directory. Note that you must use this option in conjunction with the /r option.
要注意的一点是,使用takeown /R /DY ...
将删除现有的权限,这可能不是您想要的或需要的…
作者的解决scheme是在没有/R
选项的情况下运行takeown
,并编写一个循环来改变每个目录和所有子目录的所有权。