C# 导出资源文件到硬盘

 

我把一个exe应用程序添加了资源里面,

我想,程序运行之后,点击按钮之后,就把这个资源文件导出到硬盘,

代码如下:

private void button1_Click(object sender, EventArgs e)
        {
            byte[] temp = AuthDemo.Properties.Resources.LogView;
            System.IO.FileStream fileStream = new System.IO.FileStream(Application.StartupPath + @"\test.exe", System.IO.FileMode.CreateNew);
            fileStream.Write(temp, 0, (int)(temp.Length));
            fileStream.Close();
        }

我们导出到了程序运行目录,并且名称为test.exe,我们试下exe程序是否能正常运行,下面如图所示,能正常运行哈。

 

相关文章:

  • 2021-11-03
  • 2021-11-21
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
猜你喜欢
  • 2021-09-17
  • 2021-10-21
  • 2021-06-26
  • 2021-12-20
  • 2021-10-25
  • 2021-12-10
  • 2022-01-17
相关资源
相似解决方案