以下代码在我的开发电脑上可以正常调用执行FirefoxPortable.exe;但打包安装到其他电脑后,这段代码调用的结果却是打开了“firefoxPath”这个目录,并没有运行“FirefoxPortable.exe”。怎么会这样?
开发工具:VS 2010
打包工具:Setup Factory 9
[code="java"]
private void openInternetBank(String url)
{
try
{
String firefoxPath = Path.GetTempPath() + "\InternetBankClient\FirefoxPortable";
String firefoxFileName = "FirefoxPortable.exe";
copyFirefox(firefoxPath, firefoxFileName);
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = firefoxPath + "\\" + firefoxFileName;
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
startInfo.Arguments = url;
Process.Start(startInfo);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
[/code]
其他电脑需要安装 。net框架,要用相对路径然后就可以了。
还有你找的是火狐 FirefoxPortable。exe的位置,最好把这个exe放在程序同步的位置,这样任何电脑只要装了。net框架,就可以运行了。
这样你只要获取exe运行的位置,把这个位置传入,就可以了
[url]http://blog.csdn.net/norsd/article/details/8710729[/url]
连接为获取当前exe的运行的path。