Debugging with command-line parameters in Visual Studio

前端 未结 9 1820
误落风尘
误落风尘 2020-11-22 14:52

I\'m developing a C++ command-line application in Visual Studio and need to debug it with command-line arguments. At the moment I just run the generated EXE file with the ar

相关标签:
9条回答
  • 2020-11-22 15:15

    With VS 2015 and up, Use the Smart Command Line Arguments extension. This plug-in adds a window that allows you to turn arguments on and off:

    Smart Command Line Arguments interface

    The extension additionally stores the arguments in a JSON file, allowing you to commit them to source control. In addition to ensuring you don't have to type in all the arguments every single time, this serves as a useful supplement to your documentation for other developers to discover the available options.

    0 讨论(0)
  • 2020-11-22 15:17

    Yes, it's in the Debugging section of the properties page of the project.

    In Visual Studio since 2008: right-click the project, choose Properties, go to the Debugging section -- there is a box for "Command Arguments". (Tip: not solution, but project).

    0 讨论(0)
  • 2020-11-22 15:20

    In Visual Studio 2017 with a .NET Core console application do the following:

    Right click on the Project in the Solution window, select "Properties", Debug (on the left side), and enter the arguments into the field "Application Arguments".

    Note that they should be space-separated.

    0 讨论(0)
  • 2020-11-22 15:32

    In Visual Studio 2010, right click the project, choose Properties, click the configuring properties section on the left pane, then click Debugging, then on the right pane there is a box for command arguments.

    In that enter the command line arguments. You are good to go. Now debug and see the result. If you are tired of changing in the properties then temporarily give the input directly in the program.

    0 讨论(0)
  • 2020-11-22 15:36

    The Mozilla.org FAQ on debugging Mozilla on Windows is of interest here.

    In short, the Visual Studio debugger can be invoked on a program from the command line, allowing one to specify the command line arguments when invoking a command line program, directly on the command line.

    This looks like the following for Visual Studio 8 or 9 (Visual Studio 2005 or Visual Studio 2008, respectively)

      devenv /debugexe 'program name' 'program arguments'
    

    It is also possible to have an explorer action to start a program in the Visual Studio debugger.

    0 讨论(0)
  • 2020-11-22 15:38

    Microsoft Visual Studio Ultima 2013.

    You can just go to the DEBUG menu → Main PropertiesConfiguration propertiesDebugging and then you will see the box for the command line arguments.

    Actually, you can set the same input arguments for all the different configurations and not only for debugging.

    From the pull down menu of configuration select: All Configurations and insert the input arguments (each argument separated by space).

    Now, you can execute your program in different modes without having to change the input arguments every time.

    0 讨论(0)
提交回复
热议问题