Command Line Arguments in Visual Studio

To run a program in Visual Studio with command line arguments, you will need to provide the arguments using the project settings.

Example

A program named filter requires 2 command line arguments - two file names:

      filter tinyG.txt tinyT.txt
    

To set the command line arguments to: tinyG.txt and tinyT.txt

  1. Under the Project menu select Properties

  2. Expand the Configuration Properties (if necessary) and select Debugging
  3. In the displayed section, find the entry labeled Command Arguments
  4. Fill in the argument strings; in this example, tinyG.txt tinyT.txt

Project Properties Dialog
    Box

Note that you can have different command line arguments for the Debug configuration and the Release configuration.

However, the command line arguments are set in the same way for both configurations.

So if you use both configurations, you will need to set the arguments twice, once for each configuration.