0

I have created a utility in C# to run various network admin tasks. I've schedule the tasks to run and everything works great, one problem I have is, one of the functions I want to run every half hour and one I want to run daily. I thought I could accomplish this by running it with a command line parameter, if run with parameter x run only x function, if y run only y function.

Is this possible? If not any suggestions on how I can accomplish this? My only other thought at this point is breaking it into 2 separate tools, but I prefer to keep it all together.

Thanks.

1 Answer 1

1

Assuming you're using windows task scheduler you can schedule the same executable multiple times; once daily, once every half hour, and you can add a different command line parameter for each scheduled task. The arguments to use for the given program are configurable in the menu for the action, where you enter in the executable file.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes this is what I would like to do, my issue is how to I capture the parameter value in the c# code to determine which code path to take?
@mgrenier It is the arguments passed to Main. They can also be accessed through Environment.GetCommandLineArgs().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.