Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Comments
Kiran Susarla 12-Dec-12 6:58am    
Will you always pass the same argument values or will these change every time?
Dominic Abraham 12-Dec-12 7:18am    
Can you try with command line arguments ?
IviKAZAZI 12-Dec-12 7:52am    
no it will be always the same argument.

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.
 
Share this answer
 
Comments
IviKAZAZI 12-Dec-12 7:52am    
but how can i read the argument from the task scheduler to the application?
Member 13415512 18-Sep-17 7:03am    
static void Main(string[] yourArgs)
{
yourArgs[0] // "your first argument";
yourArgs[1] // "your second argument";
}
Member 13415512 18-Sep-17 7:02am    
How can we pass multiple arguments from a task scheduler ?
Hi
I think you can read the arguments from your Task Scheduler in your application main method.
For Example.

C#
[STAThread]
      static void Main(string[] yourArgs)
      {
          yourArgs[0] // "your first argument";
          yourArgs[1] // "your second argument";
      }
 
Share this answer
 
v2
Comments
Dominic Abraham 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.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900