Just entering a line like this will not go through standard input. You need to direct some input, as in the first file transfer example.
If you really need a line as part of the command line, you will need to use something like echo to include the appropriate text. However, echo does not support newlines, so you need to echo each line separately:
(echo line1 and echo line2 and echo line3) | p4 client -i
It will be pretty ugly pretty fast.
It seems to you that you really want to know how to do this from C #, here is a very crude and ready-made example of starting the command line process and submitting its input:
ProcessStartInfo s_info = new ProcessStartInfo(@"sort.exe"); s_info.RedirectStandardInput = true; s_info.RedirectStandardOutput = true; s_info.UseShellExecute = false; Process proc = new Process(); proc.StartInfo = s_info; proc.Start(); proc.StandardInput.WriteLine("123"); proc.StandardInput.WriteLine("abc"); proc.StandardInput.WriteLine("456"); proc.StandardInput.Close(); String output = proc.StandardOutput.ReadToEnd(); System.Console.Write(output);
source share