Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-06-22
1
Medium Priority
?
809 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 375 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Introduction to Processes

824 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