0

I made a program that reads the output of steamCMD which is a command line application.

When I start steamCMD from the .exe file directly, everything works perfectly, but when I run it from my program I don't get any output. The command line is just black and the output I get in my app is empty. However, after I close steamCMD and hit the read button, I can read whatever it outputted which I couldn't see even in steamCMD before.

Here is my code:

Button for starting steamCMD:

compiler.StartInfo.FileName = @"C:\Users\Stelios LLAPTOP\Desktop\sCMD.exe";
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
compiler.Start();

Button to read its output:

richTextBox1.Text = compiler.StandardOutput.ReadToEnd();
compiler.WaitForExit();
  • *Button to read its output:*? The previous code, where are you calling it from? If you have it split in two parts, glue the parts together in a single method. Are you sure this program can execute correctly without specifying any parameters? – Jimi Aug 27 '19 at 18:33
  • yeah, parameters are not needed. Also i tried glueing the parts together. same resluts. But the problem here is that when the program starts, everything is black so i can't read its output – Randomouss Stuffed Aug 27 '19 at 18:42
  • Well, I know nothing about this executable (and you're not exactly providing a whole lot of details). Try this out: [How do I get output from a command to appear in a control on a Form in real-time?](https://stackoverflow.com/a/51682585/7444103) (C# code, but there a complete test Form you can add to a project as-is). See what come out of it. – Jimi Aug 27 '19 at 18:51
  • i said that this doesn't work with 2 more executables that i tested. Also, i don't care that much about reading the output of the command line because i can't even read the output from the command line program itself! It is just blank! – Randomouss Stuffed Aug 27 '19 at 18:56
  • You can run a Program, using the command line. Get its output, too (if any). In the linked sample, you can see in the animation that a Ping is executed and it's output captured. It's a text, to verify where this program writes its output to. There are also other Process settings that you may find interesting. – Jimi Aug 27 '19 at 19:05
  • I don't want to run a program using the command line. I said that i try to run a command line program from my C# Application and the command line program wont show any text. Just a black screen – Randomouss Stuffed Aug 27 '19 at 19:27
  • after i close steamCMD and hit the read button, i can read whatever it outputed and couldn't see even in the steamCMD before – Randomouss Stuffed Aug 27 '19 at 19:36
  • Your code is C# but you tagged your question as VB.Net. – Han Aug 27 '19 at 19:57
  • Oops. It is a habit because i have another account where i mainly ask vb.net questions – Randomouss Stuffed Aug 27 '19 at 20:03

0 Answers0