繁体   English   中英

System.Diagnostics.Process.Start问题

[英]System.Diagnostics.Process.Start Issue

我似乎对System.Diagnostics.Process.Start方法有一个奇怪的问题。 我有一个使用3.5 SP1 .NET Framework的C#桌面应用程序。 用户单击标签,该标签会将存储在标签中的文件夹路径作为字符串传递给函数。 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。

可以帮忙吗?

谢谢,罗伯

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM