首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >System.Diagnostics.Process.Start问题

System.Diagnostics.Process.Start问题
EN

Stack Overflow用户
提问于 2009-09-10 09:53:08
回答 1查看 5.2K关注 0票数 1

我似乎对System.Diagnostics.Process.Start方法有一个奇怪的问题。我有一个使用3.5 SP1 .NET框架的C#桌面应用程序。用户单击一个标签,该标签将存储在标签中的文件夹路径作为字符串传递给函数。Windows资源管理器将启动并显示正确的文件夹。当此工具安装在Citrix上并通过已发布的应用程序运行时,Windows Explorer仍将启动,但也会显示.NET异常消息“系统找不到指定的文件”。

代码语言:javascript
复制
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)

文件路径存在于它刚刚启动时,它是好的,代码在本地登录到服务器时没有错误,它只是作为一个已发布的应用程序出现错误,我的代码如下

代码语言:javascript
复制
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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-11-23 22:46:09

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

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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1404360

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档