【发布时间】:2020-06-09 10:15:20
【问题描述】:
我想运行任何 .exe。程序正在处理但未打开。它假装打开,但没有打开。 图片:https://prnt.sc/swgg23
private void Button1_Click(object sender, EventArgs e)
{
Process process = new Process();
process.StartInfo.FileName = DosyaYolu;
process.Start();
}
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog file = new OpenFileDialog();
file.Filter = "Exe files (*.exe)|*.exe|All files (*.*)|*.*";
file.FilterIndex = 1;
file.RestoreDirectory = true;
file.CheckFileExists = false;
file.Title = "Exe Dosyası Seçiniz..";
if (file.ShowDialog() == DialogResult.OK)
{
// dosya seçildi ise
DosyaYolu = file.FileName;
DosyaAdi = file.SafeFileName;
}
label1.Text = DosyaYolu;
}
【问题讨论】:
-
你说的假装是什么意思?
-
我的意思是“好像在工作”。
-
以
Process process = Process.Start("filename");运行它或将ProcessStartInfo 设置为process.Start(new ProcessStartInfo("filename"));
标签: c#