相关疑难解决方法(0)

最佳方法在c#中调用外部程序并解析输出

重复

在单独的程序中将控制台输出重定向到文本框 使用C#捕获nslookup shell输出

我希望从我的c#代码中调用外部程序.

我调用的程序,假设foo.exe返回大约12行文本.

我想调用程序并通过输出解析.

这样做的最佳方式是什么?

代码片段也赞赏:)

非常感谢你.

.net c#

25
推荐指数
1
解决办法
5万
查看次数

如何从内存中运行下载的文件?

可能重复:
加载EXE文件并使用C#从内存运行它

我正在使用WebClient类从Web服务器下载.exe.有没有办法可以运行.exe而不先将其保存到磁盘?

为了完整起见,让我告诉你到目前为止我所拥有的.

这是我用来开始下载的代码:

WebClient webClient = new WebClient();
webClient.DownloadDataCompleted += new DownloadDataCompletedEventHandler(webClient_DownloadDataCompleted);
webClient.DownloadDataAsync(new Uri("http://www.somewebsite.com/calc.exe"));
Run Code Online (Sandbox Code Playgroud)

在(webClient_DownloadDataCompleted)方法中,我只需从参数e中获取字节:

private void webClient_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
{
    Byte[] downloadedData = e.Result;
    // how to run this like a .exe?
}
Run Code Online (Sandbox Code Playgroud)

谢谢.

c# webclient exe bytearray download

6
推荐指数
1
解决办法
2470
查看次数

标签 统计

c# ×2

.net ×1

bytearray ×1

download ×1

exe ×1

webclient ×1