【发布时间】:2018-06-01 14:55:51
【问题描述】:
我有一个任务,我必须从 c# 项目运行 tabcmd 命令,该命令将从服务器读取画面报告并保存到 pdf 文件中。我正在使用以下代码来执行此操作。
string reportPath = "/Agency/AYR_CurrentYearAgencyIATA=0125452&:refresh=yes";
string currentYearPdf = @"C:\Reports\StatusReport_CurrentYear_0125452.PDF";
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.WorkingDirectory = @"C:\tabcmd\Command Line Utility\";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = false;
process.StartInfo.RedirectStandardOutput = false;
process.StartInfo.RedirectStandardError = false;
process.StartInfo.Arguments = "/C tabcmd login -s http://prodtableau -u xxx -p xxx";
process.Start();
process.StartInfo.Arguments = "'/C tabcmd export \"" + reportPath + "\"" +
" --pdf --pagelayout landscape--pagesize legal --width 1600 -f \"" + currentYearPdf +
"\"'";
process.Start();
当我直接从命令提示符运行这些 tabcmd 命令时,它们执行得很好,并且 pdf 文件保存到我的本地目录中,但是当通过 c# 代码运行时,第二个进程开始但它永远不会结束并且不会生成所需的 pdf 文件。 使用的 tabcmd 命令是
tabcmd export "/Agency/AYR_CurrentYearAgencyIATA=0125452&:refresh=yes" --pdf --pagelayout Landscape --pagesize legal --width 1600 -f "C:\Reports\StatusReport_CurrentYear_0125452.PDF"
【问题讨论】:
标签: c# cmd tableau-api process.start