【发布时间】:2012-02-25 04:21:01
【问题描述】:
我有这个代码:
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 并调试。
-
@JIM:那个EXE进程是你写的吗?你能改变它吗?
-
@Pedro:我试过调试,但是没有bug,没有异常。
-
@Tigran:这里没有一个 exe 文件是我的。我无法更改它们。
标签: c# command-line command-line-arguments command-prompt