How to Pass Command Line Arguments using Visual Studio

How to Pass Command Line Arguments using Visual Studio
We wanted to test an application in Visual Studio that accepts command-line parameters for some testing, by specifying different test environments. We review that command-line arguments are passed to the program when they have been invoked from the command line. So here’s what code we’ve tried and work fine:

Visual Studio enables excellent features where you can do this in the,Project Properties window on the Debug tab. Here are the steps to achieve this

1. Right-Click on Project from Solution Explorer Select Properties.

2. In the Project Properties Windows, Navigate to Debug Tab

3. You will Find the text box Command Line

So, here you can type the command line with separated by Space.

paramsvs

Note: Only separate with space ” “.

We write a simple console application to print the command line argument, and put a breakpoint to check the arguments,

paramsvs2

5/5 - (4 votes)