从运行Windows窗体一个。exe应用 [英] Running a .exe application from Windows forms
问题描述
我有我的命令提示符下运行如下的应用程序:
I have an application that I run in the command prompt as follows:
C:\some_location>myapplication.exeheaderfile.h
C:\some_location>"myapplication.exe" headerfile.h
我想创建一个Windows窗体应用程序,用户可以指定可执行文件的位置,并在头文件,使Windows窗体可以做到这一点对他来说,用户不会必须到命令行并做到这一点。
I want to create a Windows form application where the user can specify the location of the executable and also the header file so that the windows form can do this for him and the user wouldn't have to go to the command line and do it.
我很新的C#,因此任何人都可以请帮我吗?谢谢!
I'm very new to C#, so can anyone please help me out? Thank you!
推荐答案
您需要使用的 过程
类:
You need to use the Process
class:
Process.Start(@"C:\some_location\myapplication.exe");
有关参数:
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"C:\some_location\myapplication.exe";
startInfo.Arguments = "header.h";
Process.Start(startInfo);
显然,你可以拉这些名称/参数从文本框。
Obviously you can pull these names/arguments from text boxes.
这篇关于从运行Windows窗体一个。exe应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!