-
2 different tasks
I have a program that is to behave in 2 different ways. Each scenario is 80% the same. The program determines at the outset which scenario it is to work under. I don't want to ask the user what scenario to use. Can I execute then like xxx.exe/one and xxx.exe/two ? If so, how to I know which one was used ? I tried to make a copy with a different name, like xxx.exe and yyy.exe, but Me.ProductName in yyy.exe still thinks it is xxx.exe. Any ideas ?
-
Re: 2 different tasks
You would pass an argument on the commandline, for at least one but maybe both cases, e.g.
Code:
myApp.exe /x
myApp.exe /y
The arguments themselves can be anything you want because they don't really mean anything except to you. Within the app you get the commandlline and test the number and value of the arguments and then decide what to do based on the results. You can either use the e.CommandLine property in the app's Startup event handler or else use the Environment.GetCommandLineArgs method anywhere you like. There are examples of both already posted on the forum so you should search if you feel you need them.
-
Re: 2 different tasks
Just what I needed. Thanks.
-
Re: 2 different tasks
I just noticed your location Robert. I'm working in St Leonards at this very moment! Not exactly next door but close enough in Internet terms. Small world, huh?