CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Problem to define correctly with writeln?

  1. #1
    Join Date
    Nov 2018
    Posts
    6

    Problem to define correctly with writeln?

    I have a problem with this code below this text,
    more particularly with this row
    Code:
    prog.StandardInput.WriteLine(@"systeminfo | findstr / B / C:"Host Name" / C:"OS Version"");
    How to write the line or define it correctly, that will work with this program?

    Code:
     ProcessStartInfo status = new ProcessStartInfo("cmd");
     status.UseShellExecute = false;
     status.RedirectStandardOutput = true;
     status.CreateNoWindow = true;
     status.RedirectStandardInput = rue;
     var prog = Process.Start(status);
        
     prog.StandardInput.WriteLine(@"systeminfo | findstr / B / C:"Host Name"  / C:"OS Version"");
     string statustext = prog.StandardOutput.ReadToEnd()
     richTextBoxStatus.Text = statustext;

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,477

    Re: Problem to define correctly with writeln?

    You need to call CreateProcess on systeminfo directly, not on cmd.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)