我需要将文本框中的登录名和密码解析为参数以运行exe
private void button1_Click(object sender, EventArgs e)
{
string username = textBox1.Text;
string password = textBox2.Text;
Process p = new Process();
p.StartInfo.FileName = "Main.exe";
p.StartInfo.Arguments = "-IFZUpdatedOk_K0 -gna -login @username -pwd @password";
p.Start();
p.WaitForExit();
// System.Diagnostics.Process.Start("Main.exe", " -IFZUpdatedOk_K0 -gna -login email@email.com -pwd mypassword");
}``
答案 0 :(得分:1)
使用
p.StartInfo.Arguments = "-IFZUpdatedOk_K0 -gna -login " + username + " -pwd " + password;
或
p.StartInfo.Arguments = String.Format("-IFZUpdatedOk_K0 -gna -login {0} -pwd {1}"), usernmae, password);