You are writing one application in Visual Studio which accepts some command line parameter to do some operation. You pass command-line arguments to the program when it’s been invoked from the command line. But how did you do it from Visual Studio? You want to test your application, and do you really want to open the command prompt every time to pass the command line values. Really not. Here is a quick tip for all of you.
Visual Studio enables nice features where you can do this on the Debug tab. Here are the steps to achieve this
1. Right Click on Project from Solution Explorer
and Select Properties
.
2. In the Project Properties Windows, Navigate to “Debug Tab”
3. You will find the text box “Command Line”
Well, here you can type the command line separated by Space
.
Just write a simple console application to print the command line argument, and put a breakpoint to check the arguments,
So, each value separated by space has taken has a command-line argument. This will produce below output.