I am facing a trouble in executing a command in c# process with arguments. The command runs well in CMD but it returns no result with System.NotSupported
Exception.
string pdfkPath = @"C:Dummy ProjectsTestBCLConsoleApp1ConsoleApp1binDebugpdftk.exe";
var cmd = @"D:TestBCLSample.pdf dump_data | findstr NumberOfPages";
var proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = pdfkPath,
Arguments = cmd,
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
proc.Start();
var output = proc.StandardOutput.ReadToEnd();
The below command gives proper result in CMD, but no luck in C# code.
pdftk.exe D:TestBCLSample.pdf dump_data | findstr NumberOfPages
I tried to use various solution including using /C /K. Or try to escape the Pipe | Operator but not getting any help with them.