FAQ: Can I use Command Line with C#

Yes, an example is below.

 

string str_writer_path=@”C:\Program Files (x86)\PDF Writer Enterprise\PDCWriter.exe”;
string str_writer_args=”PROTECT \”E:\\pdffiles\\mydocument.pdf\” /NOSTATS /OUTPUT \”E:\\Protected\””;
try
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
startInfo.FileName = str_writer_path;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = false;
process.StartInfo.RedirectStandardOutput = false;
startInfo.Arguments = str_writer_args;
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
var ExitCode = process.ExitCode;
Console.Read();

}