How to run the console application through command prompt?
Answers
Answered by
0
Answers
C# CORNER HOME
TECHNOLOGIES
MONTHLY LEADERS
ASK A QUESTION
Home
C# Language
Run Console Application with Command prompt
Run Console Application with Command prompt
Mar 21 2013 4:02 PM
hi friends,
I created a C# Application with a Plain Text Editor.I faced problem when running it with command prompt.I read some article on the internet but also facing problem.
I want how to run this app with cmd prompt and also with Visual Studio 2010(framework 4.0).
Here is my code saved in D\Data drive as FirstConsole.cs
Using System;
namespace Test{
class commandline
{
static void Main(string[]args)
{
if(args.length==0)
{
console.WriteLine("Plz enter a value");
}
else
{
for(int i=0;i<args.Length;i++)
{
console.WriteLine("i="+i+"value="+args[i]);
}
}
}
}}
Reply
Download Free Office API
ANSWERS (3)
1
Vulpes
1
96.8k
1.6m
Mar 21 2013 7:38 PM
To open the Visual Studio 2010 command prompt:
Click Start -> All Programs -> Microsoft Visual Studio -> Visual Studio Tools -> Visual Studio Command Prompt.
Now type the following (csc.exe is the C# compiler):
d:
cd Data Drive
csc FirstConsole.cs
There are several minor errors in your program and once you've corrected these and successfully compiled it, you'll end up with an executable called FirstConsole.exe.
To run it just type:
Similar questions