Solved

how to hide the console when using Management class "win32_process" to start another proceess?

Posted on 2008-06-22
1
750 Views
Last Modified: 2008-06-29
hi i use the code below to start a batch file process asynchronously.  the method worksk great and doesn't ever hang (like the C# Process.Start does sometimes).  but i can't figure out how to hide the console window that pops up when the batch script begins to execute.  i had more control using the C# Process class but like i said i couldn't get it to stop hanging on one of the scripts i was trying to run.
ManagementClass processClass =

				new ManagementClass("Win32_Process");
 

			object[] methodArgs = {sScriptToExecute + " " + sScriptParams, null, null, 0 };

			int pid = (int)methodArgs[3];
 

			object result =

				processClass.InvokeMethod(

				"Create", methodArgs);

Open in new window

0
Comment
Question by:mdkooo8
1 Comment
 
LVL 41

Accepted Solution

by:
graye earned 125 total points
ID: 21896458
You can control the window via the SH_Hide attribute of the Win32_ProcessStart class

http://msdn.microsoft.com/en-us/library/aa394375(VS.85).aspx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

912 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now