看了360进程管理器,可以查看正在运行程序所依赖的动态库文件。但是我想把依赖的文件都提取出来,就写了下面的小程序。

        private void button1_Click(object sender, EventArgs e)
        {
            string fileName = "";
            string filePath = "";
            int num = 0;
            foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcessesByName(textBox1.Text))
            {
                foreach(System.Diagnostics.ProcessModule m in p.Modules)
                {
                    
                    fileName = fileName + m.FileName + "\n";
                    //添加过滤条件,提出所需的动态库
                if (m.FileName.ToLower().StartsWith("D:\\DLL\\program"))
                    {
                        filePath = "E:\\dll\\" + Path.GetFileName(m.FileName);
                        File.Copy(m.FileName, filePath, true);

                    }
                }
            }
        }

相关文章:

  • 2022-01-18
  • 2021-08-30
  • 2021-11-05
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-01-12
猜你喜欢
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-06-25
  • 2021-11-22
相关资源
相似解决方案