Click here to Skip to main content
11,927,156 members (58,057 online)
Rate this:
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
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


I think you can read the arguments from your Task Scheduler in your application main method.
For Example.

      static void Main(string[] yourArgs)
          yourArgs[0] // "your first argument";
          yourArgs[1] // "your second argument";
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


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.
IviKAZAZI 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 12 Dec 2012
Copyright © CodeProject, 1999-2015
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