0

Is there a way do get a list of open files for a process using WMIC?

Yes, there are sysinternals like HANDLE.EXE that can do this, but you have to get a copy, but more importantly if you are scripting with it and want to distribute the script, you would have to distribute the utility too. That may involve licensing problems.

But WMIC is pretty much already distributed. HANDLE.EXE may be querying WMI information under the hood, but I don't know. Certainly the Win32_Process class seems involved somehow. If so, WMIC should be able to get at it too. How? Or is HANDLE.EXE accessing other things than WMI information?

  • It's not directly possible with wmic. – DavidPostill May 25 '16 at 17:32
  • Even grabbing several different outputs for different classes, then letting the script cross-match things would be acceptable, if you count that as indirectly possible – infixed May 25 '16 at 17:47
  • 1
    There is no WMI class that can tell what file handles are open. – DavidPostill May 25 '16 at 17:55
  • See this SO question's answers for some insight as to why it's not available via WMI (hint, you need kernel access to get the list): How do I get the list of open file handles by process in C#? – Ƭᴇcʜιᴇ007 May 25 '16 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.