1

There is a way to set the default debug commandline arguments or the default application arguments without setting the arguments in the Debug tab of the project settings?

I'll mean if I can do something like this:

Module Main

#If DEBUG Then
  ' Debug Commandline arguments for my application:
  My.Application.CommandLineArgs = "-Sleep 5 -Interval 50 -Key CTRL+C"
#End If

...Sub main()
   GetArguments() ' A function wich gets the arguemnts that I've set.
...etc...

End module

1 Answer 1

2

You can create a class that will abstract your other code from command line. For debug compilation it will return fixed string, otherwise it will return real Enviroment.CommandLine.

public static class CommandLineHelper
{
  public static string GetCommandLine()
  {
   #if DEBUG
     return "my command line string";
   #else
     return Enviroment.CommandLine;
   #endif
  }
}
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for answer, I've any idea of how to do that, can you give me a reference of MSDN or something to me to start trying it?
I've added basic C# sample, you can try converting it to VB, if it is needed.
Thankyou now I understanded what you said me.

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.