看板 C_Sharp 關於我們 聯絡資訊
各位先進好 小弟最近在用ASP.NET開發網站 目前需要一個功能, 就是按下一個button後 會驅動server端的一個執行檔 目前我的寫法是按下該button後, 會執行一個C# script副程式 該副程式的語法為 System.Diagnostics.Process.Start("DFT.exe"); //參考上面幾篇文章的 然後我把DFT.exe這個執行檔和網頁檔案放在一起, 就跑了 結果他說找不到這個檔案, 加上路徑他更不認得, 直接就錯了 不知道我應該如何解決這個問題 謝謝大家!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.4.240
mygod1220:檔案路徑寫完整ㄧ點試試看,或用Server.mapPath抓 12/10 10:42
juriolegend:Directory.SetCurrentDirectory(path); 指定工作目錄 12/10 12:12
juriolegend:ProcessStartInfo myProcessStartInfo = 12/10 12:18
juriolegend:new ProcessStartInfo(path + "DFT.exe"); 12/10 12:19
juriolegend:myProcessStartInfo.WorkingDirectory = path;>"< 12/10 12:20
juriolegend:Process myProcess = 12/10 12:22
juriolegend: Process.Start(myProcessStartInfo); 12/10 12:23
yagaru:好感謝大家唷, 還把語法寫的很詳細...謝謝 12/11 00:31