System.Diagnostics.Process.Start问题

时间:2009-09-10 09:53:08

标签: c# .net citrix

我似乎对System.Diagnostics.Process.Start方法有一个奇怪的问题。我有一个使用3.5 SP1 .NET Framework的C#Desktop应用程序。用户单击标签,该标签将存储在其标签中的文件夹路径作为字符串传递给该函数。 Windows资源管理器使用正确的文件夹启动。当此工具安装在Citrix上并通过已发布的应用程序运行时,Windows资源管理器仍将启动,但也会显示一条.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,但无论如何我们在服务器上都没有IIS。

任何人都可以帮忙吗?

谢谢, 罗布

1 个答案:

答案 0 :(得分:3)

不是尝试使用文件夹名称启动进程,而是启动进程“explorer.exe”并将该文件夹的名称作为命令行参数传递。您可以在此处找到explorer.exe接受的命令行参数列表:

http://support.microsoft.com/kb/314853