我在
Windows 2008中将文件favicon.ico从一个网站文件夹复制到另一个网站文件夹.
现在我无法删除此文件,即使作为管理员也无法在安全选项卡中更改其所有者.
我该如何重新获得访问权限?
我发现
Sysinternals Handle是一个方便(和免费)的工具用于这些目的.
C:\path\to\handle.exe c:\path\to\favicon.ico
但是,handle.exe仅适用于本地句柄,并不能告诉谁打开了文件.此VBS脚本找出谁打开了文件,它可以检查远程服务器上的文件:
' WhosGotItOpen.vbs
strServername = "." ' A dot is the same as current computer.
' If you want to check Remote Server,replace dot with the name of the server.
strFilename = "myfile.ext" ' Put the name of your file here.
' Can be also be piece of the path,like: "folder\myfile"
Set objFileSystem = Getobject("WinNT://" & strServername & "/LanmanServer")
If (IsEmpty(objFileSystem) = False) Then
For Each Resource In objFileSystem.Resources
If (Not Resource.User = "") And (Not Right(Resource.User,1) = "$") Then
If Instr(1,Resource.Path,strFilename,1) > 0 Then
WScript.Echo Resource.user & ";" & Resource.Path
End If
End If
Next
Else
WScript.Echo "Error in filesystem,quitting."
WScript.Quit(2)
End If