IT박스

Windows에서 특정 파일이 열려 있는지 어떻게 확인할 수 있습니까?

itboxs 2020. 9. 25. 07:39
반응형

Windows에서 특정 파일이 열려 있는지 어떻게 확인할 수 있습니까? [닫은]


내가 가장 좋아하는 리눅스 용 도구 중 하나는 lsof- 진짜 스위스 군용 칼입니다!

오늘 저는 WinXP 시스템의 어떤 프로그램에 특정 파일이 열려 있는지 궁금합니다. lsof와 동등한 유틸리티가 있습니까? 또한 문제의 파일이 네트워크 공유를 통해 이루어 졌으므로 문제가 복잡한 지 확실하지 않습니다.


Sysinternals Suite의 Process Explorer사용 하면 Find Handle 또는 DLL 기능을 사용하여 해당 파일이 열려있는 프로세스를 검색 할 수 있습니다.


동등한 lsof -p pid것은 sysinternals 핸들과 listdll의 결합 된 출력입니다.

handle -p pid
listdlls -p pid

sysinternals로 pid를 찾을 수 있습니다 pslist.


Handle 시도하십시오 . FilemonRegmon 은 duce 프로그램 foo가 시스템에 무엇을하는지 알아내는 데에도 좋습니다.


lsof에 해당하는 하나 는 Sysinternals의 handlelistdlls의 출력을 결합 할 수 있습니다 . 즉,

c:\SysInternals>handle
[...]
------------------------------------------------------------------------------
gvim.exe pid: 5380 FOO\alois.mahdal
   10: File  (RW-)   C:\Windows
   1C: File  (RW-)   D:\some\locked\path\OpenFile.txt
[...]

c:\SysInternals>listdlls
[...]
------------------------------------------------------------------------------
Listdlls.exe pid: 6840
Command line: listdlls

  Base        Size      Version         Path
  0x00400000  0x29000   2.25.0000.0000  D:\opt\SysinternalsSuite\Listdlls.exe
  0x76ed0000  0x180000  6.01.7601.17725  C:\Windows\SysWOW64\ntdll.dll
[...]

c:\SysInternals>listdlls

안타깝게도이를 사용하려면 "관리자 권한으로 실행"해야합니다.

또한 listdll핸들 은 연속 테이블과 같은 형식을 생성하지 않으므로 파일 이름을 필터링하면 PID가 숨겨집니다. findstr /c:pid: /c:<filename>하지만 두 유틸리티 모두에 매우 가까워 야합니다.

c:\SysinternalsSuite>handle | findstr /c:pid: /c:Driver.pm
System pid: 4 \<unable to open process>
smss.exe pid: 308 NT AUTHORITY\SYSTEM
avgrsa.exe pid: 384 NT AUTHORITY\SYSTEM
[...]
cmd.exe pid: 7140 FOO\alois.mahdal
conhost.exe pid: 1212 FOO\alois.mahdal
gvim.exe pid: 3408 FOO\alois.mahdal
  188: File  (RW-)   D:\some\locked\path\OpenFile.txt
taskmgr.exe pid: 6016 FOO\alois.mahdal
[...]

여기에서 gvim.exe가이 파일을 연 파일임을 알 수 있습니다.


Unlocker를 사용해보십시오 .

The Unlocker site has a nifty chart (scroll down after following the link) that shows a comparison to other tools. Obviously such comparisons are usually biased since they are typically written by the tool author, but the chart at least lists the alternatives so that you can try them for yourself.


If the file is a .dll then you can use the TaskList command line app to see whose got it open:

TaskList /M nameof.dll

If you right-click on your "Computer" (or "My Computer") icon and select "Manage" from the pop-up menu, that'll take you to the Computer Management console.

In there, under System Tools\Shared Folders, you'll find "Open Files". This is probably close to what you want, but if the file is on a network share then you'd need to do the same thing on the server on which the file lives.


There is a program "OpenFiles", seems to be part of windows 7. Seems that it can do what you want. It can list files opened by remote users (through file share) and, after calling "openfiles /Local on" and a system restart, it should be able to show files opened locally. The latter is said to have performance penalties.


Use Process Explorer to find the process id. Then use Handle to find out what files are open.

Eg handle -p

I like this approach because you are using utilities from Microsoft itself.


In OpenedFilesView, under the Options menu, there is a menu item named "Show Network Files". Perhaps with that enabled, the aforementioned utility is of some use.

참고 URL : https://stackoverflow.com/questions/15708/how-can-i-determine-whether-a-specific-file-is-open-in-windows

반응형