To get console arguments on applications developed with WPF framework it is needed some small modifications on App.xaml and App.xaml.cs files.
First, remove the following from the App.xaml:
StartupUri="MainWindow.xaml"
Then, use the following snippet on App.xaml.cs:
protected override void OnStartup(StartupEventArgs e)
{
MainWindow WindowToDisplay = new MainWindow();
if (e.Args.Length == 0)
{
WindowToDisplay.Show();
}
else
{
string firstArgument = e.Args[0].ToString();
string secondArgument = e.Args[1].ToString();
// third ...
}
}
Resource:
