在C#中执行.Bin文件 [英] Execute .Bin File In C#
本文介绍了在C#中执行.Bin文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我有一个要在按下按钮时执行.bin文件的应用程序.
有类似的东西吗? .bin文件是带有PE标头的可执行文件.
Hi everyone!
I have a application that I want to execute a .bin file when pressing a button.
Is there something similar to this? The .bin file is a executable with a PE header.
Process.Start("Program.exe");
但作为
but as
Process.Start("Program.bin");
任何帮助将不胜感激.
Any help would be appreciated.
推荐答案
我还有一个替代解决方案:
I''ve also a alternative solution:
[System.Runtime.InteropServices.DllImport("shell32.dll")]
public static extern bool ShellExecute(IntPtr hwnd, string operation, string file, string param,int showCmd);
void ExecuteBin()
{
ShellExecute(IntPtr.Zero,null,"cmd","/c BinFile.bin",0);
}
我的工作:我调用ShellExecute
方法,然后运行cmd /c BinFile.bin
.参数showCmd
设置为0,这表示cmd没有显示.
What I do: I invoke the ShellExecute
method and I run cmd /c BinFile.bin
. The parameter showCmd
is set to 0, what means the cmd is not showing.
Nvm,我现在有解决方案.
Nvm, I have the solution now.
Process p = new Process();
p.StartInfo.FileName = "Program.bin";
p.StartInfo.UseShellExecute = false;
p.Start();
这篇关于在C#中执行.Bin文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文