Click here to Skip to main content
12,066,448 members (57,146 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
Comments
Wes Aday 11-Sep-12 7:47am
   
Start->Run->Cmd.exe
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 ""
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
 
good
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
C:\Temp\Test.exe
  Permalink  
Comments
Espen Harlinn 11-Sep-12 8:29am
   
A 5, tempted to say something more, but ...
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,

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()
{
   Console::WriteLine();
 
   //  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,
Thanks
-Amit Gajjar
  Permalink  
v2

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
Web02 | 2.8.160208.1 | Last Updated 11 Sep 2012
Copyright © CodeProject, 1999-2016
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