Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
"The resource cannot be found" 1 22
parsing question on dynamic concatenation 3 33
Connect Gridview column to Textbox in C# 2 36
ASP.NET data base connection 35 33
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.

762 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