How to execute and capture the output of a command line in C #

0

Person, is as follows. I have an application that works on the command line. This application receives parameters by command line, eg: program.exe [parameters] I want to make an interface where I run this application by passing the commands and capture what the application is displaying on the command line, and show this in a txtLabel. The part of passing the commands and running the application I know how to do. What I can not do is capture what's going out on the command line and display it on a Label.

I was thinking of making the application in cmd save the output in .txt and with the interface in C #, read this .txt and display on screen. But I do not think I'm the ideal.

In my case I'm running the youtube-dl and I want to capture the output of it constantly and show it in a label.

    
asked by anonymous 25.07.2018 / 17:51

1 answer

0

I've already done what you're trying to do. Just run your console application through cmd via C #. In the example below on the correct answer, where "command" is replaced by the path + executable of your application + required parameters .

link

    
27.07.2018 / 03:40