Solved

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

Posted on 2008-06-22
1
733 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

A short article about a problem I had getting the GPS LocationListener working.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

758 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

19 Experts available now in Live!

Get 1:1 Help Now