using C# Process to run a Executable program

我的梦境 提交于 2019-12-01 00:51:29

One problem I can see is in the line where you set the Arguments:

proc.StartInfo.Arguments = "blastp -query input.txt -db pdbaa -out output.txt";

I think you meant:

proc.StartInfo.Arguments = "-query input.txt -db pdbaa -out output.txt";

So you don't need to specify the executable name again in the Arguments - that's what FileName is for.

The other thing is that there are a lot of applications which don't behave too well if you don't use shell-execute to start them. Try it first with shell-execute (and obviously without redirecting any std*), and if it works that way, then you'll know what the issue is - although I'm afraid there's not much you can do about it.

Also, why is the line

proc.StartInfo.RedirectStandardError = true;

repeated twice?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!