[英]How to create a command line to run c# exe file and give some parameters to a function in form1?
我有我想运行的 c# 程序,但是从 cmd 使用命令行所以这是我的问题我不知道如何创建命令,我不知道如何将命令中的参数发送到那里的某个函数.
您可以使用 Process 类来执行文件
var fileName = "some.exe";
var arguments = "";
var info = new System.Diagnostics.ProcessStartInfo(fileName, arguments);
info.UseShellExecute = false;
info.CreateNoWindow = true;
// if you want read output
info.RedirectStandardOutput = true;
var process = new System.Diagnostics.Process { StartInfo = info };
process.Start();
var output = process.StandardOutput.ReadToEnd();
var error = process.StandardError?.ReadToEnd();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.