簡體   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