Revuen Ben Dror
Revuen Ben Dror

Reputation: 237

How do i change directories on command prompt in runtime and then run another process?

I have this code:

var process = new System.Diagnostics.Process();
var startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C copy /b Image1.jpg + Archive.rar Image2.jpg";
process.StartInfo = startInfo;
process.Start();

This will open/run the cmd.exe will hide the window and do the Arguments. What i want to do is that it will run the cmd.exe then will go to:

D:\pipetest\pipetest\ffmpegx86

Will do another Arguments:

"rem ffmpeg -f rawvideo -pix_fmt rgb24 -video_size 1280x720 -i \\.\pipe\mytestpipe -map 0 -c:v libx264 -r 25 out.avi"

Then it will make the command start the process name: Run

I mean after it will make the arguments it will make Run like i'm typing Run and enter in the command prompt window.

How can i do it ?

Upvotes: 1

Views: 474

Answers (1)

Roger Lipscombe
Roger Lipscombe

Reputation: 91835

Run one process, then the other, or put the various commands you need to run in a batch file, and then run that.

Upvotes: 1

Related Questions