我想要獲得在內存中使用Application.ExecutablePath
在內存中運行的可執行文件的位置,並將其從當前位置刪除,但是我得到錯誤The system cannot find the file specified
。如何處理文件名
據我瞭解,這是因爲路徑中的空間。我如何解決這個問題?下面是相關代碼:
System.Diagnostics.Process p = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = @"cmd.exe /C Del " + Path.GetFullPath(Application.ExecutablePath);
p.StartInfo = psi;
p.Start();
當您修復路徑時,您可能會收到「使用中的文件」異常。 – 2012-03-14 12:17:07