private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileName = openFileDialog1.FileName;
ProcessStartInfo info = new ProcessStartInfo();
info.WindowStyle = ProcessWindowStyle.Hidden;
info.FileName = "WK01.exe";
info.Arguments = "WK01.exe";
info.Arguments = fileName;
Process p = new Process();
p.StartInfo = info;
p.Start();
p.WaitForExit();
}
}
当我运行这段代码时,这段代码会中断p.Start();
,因为我的 WK01.exe 项目包含 2 个参数,一个是它的路径,第二个是我给它的图片或任何东西,当我运行它并按下它要求我的按钮时当我选择它破坏程序的文件时选择文件p.Start();