我想从另一个程序处理控制台应用程序 [英] I want to deal with a console application from another program

查看:80
本文介绍了我想从另一个程序处理控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的领域有一个名为Clustalw2的程序,它接受一个包含DNA序列的文件并接收一些命令(在控制台窗口中)来操纵这些数据以导出一个文本文件,我想在我编写的另一个程序中导入该文件问题是:



1-在我的程序中打开这个程序并发送它的数据位置和命令系列

2-threading my program to等待clustalw完成数据处理以导入结果文件



我已经尝试了下一个在Dos中运行程序的代码,但它没有工作:

There are a program in my field called Clustalw2 which take a file contain DNA sequences and recieve a sort of commands (in console window) to manipulate these data to export an text file which I want to import in another program I have written the problem is :

1- open this program inside my program and sending it data location and commands series
2-threading my program to wait the clustalw to finish data processing to import results files

I have tried the next code to run program in Dos but it didn''t work:

System.Diagnostics.ProcessStartInfo sdpsinfo =new System.Diagnostics.ProcessStartInfo ("cmd.exe", @"C:\Program Files (x86)\ClustalW2\clustalw2.exe");
         sdpsinfo.RedirectStandardOutput = true;
         sdpsinfo.UseShellExecute = false;
         sdpsinfo.CreateNoWindow = true;
         System.Diagnostics.Process p = new System.Diagnostics.Process();
         p.StartInfo = sdpsinfo;
         p.Start();
         string res = p.StandardOutput.ReadToEnd();
         Console.WriteLine(res);
         Console.Read();

推荐答案

您的代码片段和标签建议您使用.NET,据我所知,没有一个可以托管.NET支持的系统,例如DOS,这是一个古老的历史想要的操作系统。所以,这个问题毫无意义。



对于.NET或原生Windows控制台应用程序,它们是常规Windows(保护模式,针对x86,x86) -64或Itanium,完全无法在DOS等使用的16位实模式下运行。与DOS无关的应用程序,与其他任何Windows应用程序没有什么不同,只有一点点不同:它们显示了标准控制台。



拥有一个控制台不能妥协任何功能。你可能遗漏了一些非常基本的东西;并且您没有提供任何有助于理解内容的信息。



-SA
Your code fragment and tag suggest you use .NET, and, to best of my knowledge, none of the systems which can host .NET support such thing as "DOS", which is an old historical wanna-be-OS. So, the question makes no sense at all.

As to .NET or native windows console applications, they are regular Windows (protected-mode, targeted to x86, x86-64 or Itanium, fully incapable of running in that 16-bit real-mode used by DOS, etc.) applications having nothing to do with DOS, and not really different from any other Windows application, with one little difference: they show a standard console.

Having a console cannot compromise any functionality at all. You are probably missing something very basic; and you do not provide any information helping to understand what.

—SA


这篇关于我想从另一个程序处理控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆