我有這樣的代碼:與參數命令行
string filePath = ConfigurationManager.AppSettings.Get("FILE_SAVE_PATH") + fileName;
string newFilePath = ConfigurationManager.AppSettings.Get("FILE_SAVE_PATH") + fileName.Replace(".dbf", ".csv");
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WorkingDirectory = ConfigurationManager.AppSettings.Get("FILE_SAVE_PATH");
startInfo.FileName = "cmd.exe";
startInfo.Arguments = string.Format("\"{0}\" \"{1}\" /EXPORT:{2} /SEPTAB", ConfigurationManager.AppSettings.Get("DBF_VIEWER_PATH"), filePath, newFilePath);
try
{
using (Process exeProcess = Process.Start(startInfo))
{
exeProcess.WaitForExit();
}
}
catch{}
的問題是,它啓動命令行,什麼都不做。它似乎沒有將參數傳遞給命令行(命令行爲空)。任何人都有一個想法,問題可能在哪裏?
你是隱藏任何異常,所以你不能真正知道了什麼錯誤發生的事情......接招的try/catch路程,DEBUG。 – Pedro 2012-02-02 13:59:11
@JIM:你的EXE過程是由你寫的嗎?你能改變它嗎? – Tigran 2012-02-02 14:07:15
@Pedro:我嘗試過調試,但沒有錯誤,沒有例外。 – JNM 2012-02-03 05:34:42