Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET Task
Hello all,
 
I have a console application which i run as a task,and i need to pass a parameter to it.Is there any workaround to do this from the task scheduler?
 
Thanks in advance!
Posted 12-Dec-12 1:42am
IviKAZAZI1.5K
Comments
Kiran Susarla at 12-Dec-12 6:58am
   
Will you always pass the same argument values or will these change every time?
Dominic Abraham at 12-Dec-12 7:18am
   
Can you try with command line arguments ?
IviKAZAZI at 12-Dec-12 7:52am
   
no it will be always the same argument.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi
 
I think you can read the arguments from your Task Scheduler in your application main method.
For Example.
 
[STAThread]
      static void Main(string[] yourArgs)
      {
          yourArgs[0] // "your first argument";
          yourArgs[1] // "your second argument";
      }
  Permalink  
v2
Comments
Dominic Abraham at 12-Dec-12 8:01am
   
If the solution is helpful don't forget to mark it as answer. So that it may help others with similar issues.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi
 
In task scheduler, you can specify the command line arguments. Go to task scheduler -> double click on your task --> Go to 'Actions' --> Select your action --> 'Edit' --> 'Add Argumenets'. This you can read in your application start up.
  Permalink  
Comments
IviKAZAZI at 12-Dec-12 7:52am
   
but how can i read the argument from the task scheduler to the application?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 12 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100