Reputation: 1308
I am trying to find an easier way to test my command line application. It has arguments so I run it from a command prompt. My process is this:
There has to be an easier way not only to debug but to open a command prompt in the current folder.
Thank you for your time.
Upvotes: 0
Views: 690
Reputation: 1911
See Debugging with command-line parameters in Visual Studio
Alternatively, you should be able to use a shell script (or Python os.system()) to automate some of those steps.
Upvotes: 2
Reputation: 4249
There is an extension called PowerCommands for Visual Studio 2010
that can be installed from Tools -> Extension Manager
. It includes a Open Containing Folder
and Open Command Prompt
functionality that gets added to your right-click menu in the Solution Explorer.
Upvotes: 0
Reputation: 28583
If you go to the project properties, Debugging settings, you can set the working directory and parameters. If you use the same parameters all of the time, you can enter those in on that screen as well. Then just F5 or Ctrl+F5 to run.
Set a breakpoint at the end of the code to keep it from going away after it is done.
Upvotes: 3
Reputation: 25710
In project properties under debugging you can set the command line arguments (and environment variables) when debugging,
Upvotes: 0
Reputation: 126
If you're using Visual Studio, pressing F5 will run the code in the debugger, and Ctrl+F5 will run the code normally. Just remember to include a cin.get()
statement at the end or the terminal window will close before you can read the output.
Other IDEs should have similar functions. Check in the Run or Debug menu.
EDIT: Sorry, didn't see that you're asking about running it with arguments. In VS, in Project Properties there are the Debugging settings. Within that, there is a field called Command Arguments. These will get passed to the application when you run it from within VS.
Upvotes: 0
Reputation: 9132
To open a command prompt in the current directory using explorer, you can shift+right click->Open Command Window Here. That will save a little time.
Upvotes: 0