T
T
TheTalion2018-08-23 01:17:35
Windows
TheTalion, 2018-08-23 01:17:35

How to get the name of an open file from a process in windows?

I want to know the name of the process (ff.exe). How can I do that? It turns out only to find out what it is notepad.exe.
5b7de07deb848498383623.png
Tried in the spirit:

public static bool FileLocked(string id)
    {
      var process = Process.GetProcessesByName ("notepad.exe");
      foreach (Process proc in process) 
      {
        if (proc.MainModule.FileName == id)
          return true;
      }
      return false;
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Ltonid, 2018-08-23
@AtaZ

Everything was mixed. You have a notepad.exe process, and the parameter to it is a file. There, in the manager, on the detailed tab, turn on the Command line column and you will understand everything. I won't tell you about the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question