[英]How can I set an ASP.Net Core exe.config value from Azure App Service Connection String
[英]Can I call console app exe from asp.net with 2 argument?
我可以從asp.net Web表單調用控制台應用程序,但是如果我從用戶輸入中得到第一個自變量,則按如下所示逐個輸入,則他們有另一個輸入,請輸入另一個數字,然后用戶需要在控制台中輸入另一個自變量應用程式。 我有2個論點,但兩者都會一一對應。 如果是第一次使用單個參數,那么我可以按以下方式進行傳遞,但使用2則不能。 這怎么可能呢?如果有人幫助的話,那將是一件好事。 我想通過兩個論點。
Process p1 = new Process();
p1.StartInfo.FileName = "ConsoleEx.exe"; // actual file name
p1.StartInfo.Arguments = "1 ";
p1.StartInfo.UseShellExecute = false;
p1.StartInfo.RedirectStandardOutput = true;
p1.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p1.Start();
p1.WaitForExit();
if (p1.HasExited)
{
string output = p1.StandardOutput.ReadToEnd();
lblConsoleOutput.Text = output;
p1.Dispose();
}
static void Main(string[] args)
{
int num1, num2;
int add, sub, mul;
float div;
Console.Write("Enter 1st number\t");
num1 = Convert.ToInt32(Console.ReadLine());
Console.Write("\nEnter 2nd number\t");
num2 = Convert.ToInt32(Console.ReadLine());}
這是圖片
重定向標准輸入並通過代碼流式傳輸值。
你可以在這里找到一個例子。 http://msdn.microsoft.com/zh-CN/library/system.diagnostics.processstartinfo.redirectstandardinput%28v=vs.110%29.aspx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.