Click here to Skip to main content
Rate this: bad
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 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
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 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
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 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 485
1 Maciej Los 285
2 OriginalGriff 285
3 Peter Leow 260
4 John C Rayan 162
0 Sergey Alexandrovich Kryukov 7,203
1 OriginalGriff 5,587
2 Peter Leow 4,097
3 Mika Wendelius 2,850
4 CHill60 2,818

Advertise | Privacy | Mobile
Web01 | 2.8.150224.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