Click here to Skip to main content
12,765,284 members (36,965 online)
Rate this:
Please Sign up or sign in to vote.
I have an visual studio application that reads the ip address and port no from an ini file and send the data on that socket.
I have to run the program from command line.Right now i open the visual studio and run the program by clicking on debug.How to run the program from command line.
How do i convert the solution into the command line?
Posted 11-Sep-12 2:46am
Wes Aday 11-Sep-12 7:47am
Tarun Batra 11-Sep-12 7:49am
Do i have to change anything in my code?
Wes Aday 11-Sep-12 7:50am
To run from a command line? No
Jochen Arndt 11-Sep-12 7:53am
... and enter "<your-project-drive-and-path\debug-or-release\your-project-name>"
pasztorpisti 11-Sep-12 8:25am
Your intentions are not clear. What do you want to do?
1. Start visual studio and start the project int debug mode??? (this is totally pointless)
2. Just start the ready-made program without visual studio if possible? (this is possible of course)
3. Start visual studio and compile it from command line?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Just open the console "Cmd.exe" and navigate to your output folder. There just start the exe. So, if your exe is called "Test.exe" and lies in C:\Temp, just execute
Espen Harlinn 11-Sep-12 8:29am
A 5, tempted to say something more, but ...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


You need to use Environment GetCommandLineArgs function to access your parameters. you need to check what is the entry point of your application. there you need to get and process your parameters.

You also need to specify appropriate exception or further message if parameter are missing.

Something like,

using namespace System;
int main()

   //  Invoke this sample with an arbitrary set of command line arguments.
   array<String^>^arguments = Environment::GetCommandLineArgs();
   Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) );

(Code from MSDN)

Hope this works for you,
-Amit Gajjar

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170217.1 | Last Updated 11 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100