Debugging with command-line parameters in Visual Studio


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 arguments I need (like this program.exe -file.txt) , but this way I can't debug. Is there somewhere I can specify the arguments for debugging?

2/27/2010 7:22:29 PM

Accepted Answer

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

In VS 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)

8/1/2017 3:29:06 PM

The 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

 devenv /debugexe 'program name' 'program arguments'

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

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow