Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hidden Command Line

Status
Not open for further replies.

evoroel

IS-IT--Management
Jun 23, 2003
39
0
0
BE
Hi

I've written a small command line report tool that reports to a web service.

I have scheduled this tool to run every 10 minutes using Scheduled Tasks.

So every 10 minutes I get a dos box when the tool is started.

To solve this I use a freeware app speedup.exe. This app sets the window hidden.

I'm sure this could be done from inside the report tool as well, but I did not find this.

I have found the WindowStyle attribute but I'm not able to set this for the running application.

Any pointers?

Tnx
evoroel
 
Here is an example of using the Process class to start a process with no window (CreateNoWindow) and without using the shell operating system (UseShellExecute = false). I uncommented some lines that could be used when you want that process to rise events and capture them.
Code:
string workingDirectory=".....";
string myExe ="myapp.exe";
string cm ="/all /nodump";
System.Diagnostics.Process P = new System.Diagnostics.Process();
//P.StartInfo.RedirectStandardOutput = true;
P.StartInfo.CreateNoWindow = true;
P.StartInfo.WorkingDirectory = WorkingDirectory;
P.StartInfo.FileName =  WorkingDirectory + "\\" + myExe;
P.StartInfo.Arguments = cm;						
//P.EnableRaisingEvents = true;
P.StartInfo.UseShellExecute = false;
//P.Exited += new EventHandler(captureStdout);
try
{
P.Start();
}
catch(Exception exProcess)
{
}


//private void captureStdout(object sender, EventArgs e) 
//{      
//	System.Diagnostics.Process ps = (System.Diagnostics.Process) sender;      
	//string s = ps.StandardOutput.ReadToEnd();

//}
-obislavu-
 
Yes, I figured this out myself (found some examples as well) but it's not what I'm looking for.

I want the current process to start hidden, not create a new process first.
 
evoroel -
In your public static Main method, just don't create the form if you don't want a visual interface.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
It is allready a command line application, so there are no forms created.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top