运行 来自 FileStream 的 exe 文件
Run exe file from FileStream
我正在尝试通过 filestream 运行 一个 exe 文件,但是当我调用该命令时没有任何反应。
我的代码:
string filePath = AppDomain.CurrentDomain.BaseDirectory + "OUT\WAMServer.exe";
// read the bytes from the application exe file
FileStream fs = new FileStream(filePath, FileMode.Open);
BinaryReader br = new BinaryReader(fs);
byte[] bin = br.ReadBytes(Convert.ToInt32(fs.Length));
fs.Close();
br.Close();
// load the bytes into Assembly
Assembly a = Assembly.Load(bin);
有人有提示或解决方案吗?
这是一个 运行 可执行文件的示例:
static void Main(string[] args)
{
string filename = @"C:\windows\System32\notepad.exe";
Process.Start(filename);
}
Assembly.Load()
不会 运行 可执行文件,而是将其加载到应用程序域中,因此 Process.Start()
可能就是您要查找的内容。
如果你真的想从字节数组启动非托管应用程序
试试这个 link
我正在尝试通过 filestream 运行 一个 exe 文件,但是当我调用该命令时没有任何反应。
我的代码:
string filePath = AppDomain.CurrentDomain.BaseDirectory + "OUT\WAMServer.exe";
// read the bytes from the application exe file
FileStream fs = new FileStream(filePath, FileMode.Open);
BinaryReader br = new BinaryReader(fs);
byte[] bin = br.ReadBytes(Convert.ToInt32(fs.Length));
fs.Close();
br.Close();
// load the bytes into Assembly
Assembly a = Assembly.Load(bin);
有人有提示或解决方案吗?
这是一个 运行 可执行文件的示例:
static void Main(string[] args)
{
string filename = @"C:\windows\System32\notepad.exe";
Process.Start(filename);
}
Assembly.Load()
不会 运行 可执行文件,而是将其加载到应用程序域中,因此 Process.Start()
可能就是您要查找的内容。
如果你真的想从字节数组启动非托管应用程序 试试这个 link