Hide Window when running console application exe by TaskScheduler

Aug 6, 2012 at 10:41 AM

How can i Hide Window when running console application which running by TaskScheduler.

Below the code i have written to create task. 

TaskDefinition td = ts.NewTask();             

 td.RegistrationInfo.Description = "Convert TO HL7 Message";               

td.Settings.Hidden = true;               

TimeTrigger tt = new TimeTrigger();               

tt.StartBoundary = DateTime.Now;                

tt.Repetition.Interval = TimeSpan.FromMinutes(1);               

tt.Repetition.Duration = TimeSpan.FromDays(1);                


string argument = textBox1.Text.Replace(' ', '^');               

argument = argument + "$" + textBox2.Text.Replace(' ', '^');               

argument = argument + "$" + textBox3.Text.Replace(' ', '^');               

string exePath = System.Configuration.ConfigurationManager.AppSettings["ConvertToHL7ExePath"].ToString();   td.Actions.Add(new ExecAction(exePath, argument, null));                ts.RootFolder.RegisterTaskDefinition(@"Test", td);                


Aug 6, 2012 at 4:38 PM

I think you can try some combination of calling the cmd.exe with the start command. I haven't tested this, but I would try something like:

cmd.exe /c start /min executable.exe
Aug 23, 2012 at 10:00 AM

Hi, if you are using visual studio as you IDE, what you are looking for is:

  • In the Solution Explorer, Right click on the project file (not the solution file)
  • Properties
  • Application tab (if you aren't there by default)
  • Find the dropdown marked "Output type:"
  • Change the selection from "Console Application" to "Windows Application"
  • Save and run.

That should sort you out :)