[英]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.