Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 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
Comments
[no name] 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?
[no name] 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?

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#
C:\Temp\Test.exe
 
Share this answer
 
Comments
Espen Harlinn 11-Sep-12 8:29am    
A 5, tempted to say something more, but ...
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,

C++
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
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900