我似乎对System.Diagnostics.Process.Start方法有一个奇怪的问题。我有一个使用3.5 SP1 .NET框架的C#桌面应用程序。用户单击一个标签,该标签将存储在标签中的文件夹路径作为字符串传递给函数。Windows资源管理器将启动并显示正确的文件夹。当此工具安装在Citrix上并通过已发布的应用程序运行时,Windows Explorer仍将启动,但也会显示.NET异常消息“系统找不到指定的文件”。
System.ComponentModel.Win32Exception: The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)文件路径存在于它刚刚启动时,它是好的,代码在本地登录到服务器时没有错误,它只是作为一个已发布的应用程序出现错误,我的代码如下
Label label = (Label)sender;
if (label.ForeColor == Color.Blue) {
if (System.IO.Directory.Exists(label.Tag.ToString()) == false)
{
MessageBox.Show("The specified folder does not exist:" +
Environment.NewLine + Environment.NewLine + label.Tag.ToString(), "",
MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
System.Diagnostics.Process.Start(label.Tag.ToString());
}我发现这个页面是http://forums.citrix.com/thread.jspa?messageID=1382638的,但是我们的服务器上没有。
有人能帮上忙吗?
谢谢,Rob
发布于 2009-11-23 22:46:09
启动进程"explorer.exe“并将文件夹的名称作为命令行参数传递,而不是尝试使用文件夹名启动进程。您可以在以下位置找到explorer.exe接受的命令行参数列表:
http://support.microsoft.com/kb/314853
https://stackoverflow.com/questions/1404360
复制相似问题