Solved

Avoid Console Flash On Screen

Posted on 2004-09-26
6
249 Views
Last Modified: 2012-06-27
Ok, one more question!  If I use this code (courtesey of eternal 21):

                  System.Diagnostics.Process process = new System.Diagnostics.Process();
                  process.StartInfo.FileName = "cmd";
                  process.StartInfo.UseShellExecute = false;
                  process.StartInfo.Arguments = "/c net send * hello world!";
                  process.Start();

Is there a way to hide the console flashing on the screen when executing command line commands?
0
Comment
Question by:fattumsdad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:eternal_21
ID: 12156805
Sorry, fattumsdad:

  process.StartInfo.RedirectStandardOutput = true;
  process.StartInfo.RedirectStandardError = true;
0
 
LVL 10

Expert Comment

by:eternal_21
ID: 12156808
I had used 'UseShellExecute = false' so that you did not see another window, but assumed that you were in a Windows Application, not a Console Application!

- eternal
0
 
LVL 1

Author Comment

by:fattumsdad
ID: 12156819
eternal,

I am in a Windows Application :) When I click on button1 to execute the command, a console window pops up for a split second and executes it, then disappears. :)
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 1

Author Comment

by:fattumsdad
ID: 12156823
When I add:

process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;

It still flashes a "command prompt" for a second :(
0
 
LVL 10

Accepted Solution

by:
eternal_21 earned 500 total points
ID: 12156990
Oh man, am I getting rusty or what? :)

For a Windows Application OR a Console Application:

  process.StartInfo.CreateNoWindow = true;
  process.StartInfo.UseShellExecute = false;

You can forget about the redirect error statements, they will not be necessary if you are using "CreateNoWindow = true".  Sorry about the confusion, fattumsdad.
0
 
LVL 1

Author Comment

by:fattumsdad
ID: 12157040
eternal,

Rusty or not, you're still helping me out quite a bit!!  Works great, thanks again!!!
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question