在C#中,写了一个功能,把要调用的exe放到bin里了,运行总是显示找不到指定的文件,对路径很是迷惑,求各位指点迷津。
 protected void btnScan_Click(object sender, EventArgs e)
    {
            p = new System.Diagnostics.Process();
            //p.StartInfo.FileName = "E://Downloads//yuexe//NewScan//NewScan.exe";这是绝对地址,可是打包以后便不能运行了,如何改成相对地址呢?
            //p.StartInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory + "NewScan//NewScan.exe";把此exe放到bin里之后这样调用也不可以,求助
            p.StartInfo.FileName = @"NewScan//NewScan.exe";
            p.Start();
            if (p.HasExited) //是否正在运行
            {
                p.Kill();
            }
        p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
    }相对路径调用exec#exe