按下按钮从Windows窗体运行控制台 [英] run Console from windows form by pressing button

查看:86
本文介绍了按下按钮从Windows窗体运行控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个项目,一个是Windows窗体,第二个是控制台项目,每次按下窗体中的按钮时,我需要运行一个控制台。我尝试将控制台项目作为参考来进行Windows项目,还有控制台的代码
,如下所示

I have two project one is windows form and second is a console project, I need to run the console one every time when pressing the button in windows form. I tried to make console project as reference to windows project, also the code of the console as in follows


   public class Program
    {
        public static void Main(string[] args)
        {
            using (StreamWriter writer = new StreamWriter(@"C:\Users\Farttoos\Desktop\Nasser\_Last\Crypto(AES)_Stego(text)_Final\Crypto_Stego\Dictionary.txt"))
            {
                Console.SetOut(writer);
               Console.Write("Hello World!");

                Act();
            }
        }
    
    }
}

推荐答案

如果我理解你的要求,那么你可以使用
流程类(System.Diagnostics)
,如在  Process.Start方法(字符串)(System.Diagnostics)
有很多选项。
If I understand what you are asking then you can use the Process Class (System.Diagnostics), as in Process.Start Method (String) (System.Diagnostics). There are very many options.


这篇关于按下按钮从Windows窗体运行控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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