Questions tagged [console-application]

A console application is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command line interface of some operating systems (Unix, DOS, etc.) or the text-based interface included with most Graphical User Interface (GUI) operating systems, such as the Win32 console in Microsoft Windows, the Terminal in Mac OS X, and xterm in Unix.

A console application is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command line interface of some operating systems (Unix, DOS, etc.) or the text-based interface included with most Graphical User Interface (GUI) operating systems, such as the Win32 console in Microsoft Windows, the Terminal in Mac OS X, and xterm in Unix. A user typically interacts with a console application using only a keyboard and display screen, as opposed to GUI applications, which normally require the use of a mouse or other pointing device. Many console applications such as command line interpreters are command line tools, but numerous text-based user interface (TUI) programs also exist.

As the speed and ease-of-use of GUI applications have improved over time, the use of console applications has greatly diminished, but not disappeared. Some users simply prefer console based applications, while some organizations still rely on existing console applications to handle key data processing tasks.

7241 questions
97
votes
6 answers

Command to close an application of console?

I need to close the console when the user selects a menu option. I tried using close() but it did not work.. how can I do this?
ale
  • 3,301
  • 10
  • 40
  • 48
95
votes
4 answers

Using UTF-8 Encoding (CHCP 65001) in Command Prompt / Windows Powershell (Windows 10)

I've been forcing the usage of chcp 65001 in Command Prompt and Windows Powershell for some time now, but judging by Q&A posts on SO and several other communities it seems like a dangerous and inefficient solution. Does Microsoft provide an improved…
Paul Kim
  • 1,153
  • 1
  • 9
  • 17
94
votes
8 answers

Make the console wait for a user input to close

I have a console application that after performing its tasks, must give feedback to the user, such as "operation completed" or "operation failed" and the detailed error. The thing is, if I just "let it run", the output message will be printed but…
makoshichi
  • 2,310
  • 6
  • 25
  • 52
87
votes
2 answers

Error message "CS5001 Program does not contain a static 'Main' method suitable for an entry point"

Unable to execute the following code error CS5001 Program does not contain a static 'Main' method suitable for an entry point What does this error message mean? class Program { static async Task MainAsync(string[] args) { …
001
  • 62,807
  • 94
  • 230
  • 350
81
votes
10 answers

how to run a winform from console application?

How do I create, execute and control a winform from within a console application?
reshefm
  • 6,017
  • 8
  • 36
  • 40
74
votes
3 answers

How do I get a return value from Task.WaitAll() in a console app?

I am using a console app as a proof of concept and new need to get an async return value. I figured out that I need to use Task.WaitAll() in my main method to avoid needing an async "main()" method, which is illegal. I'm now stuck trying to figure…
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
73
votes
7 answers

How to display list items on console window in C#

I have a List that contains all databases names. I have to display the items contained in that list in the Console (using Console.WriteLine()). How can I achieve this?
ravikiran
73
votes
4 answers

WinForms Applications: Where is console.writeline() output rendered?

I created a windows form solution and in the constructor of a class I called Console.WriteLine("constructer called") But I only got the form and not the console.. so where is the output?
SmartestVEGA
  • 8,415
  • 26
  • 86
  • 139
72
votes
14 answers

How do you clear the console screen in C?

Is there a "proper" way to clear the console window in C, besides using system("cls")?
devurs
  • 853
  • 1
  • 7
  • 6
68
votes
7 answers

Use wc on all subdirectories to count the sum of lines

How can I count all lines of all files in all subdirectories with wc? cd mydir wc -l * .. 11723 total man wc suggests wc -l --files0-from=-, but I do not know how to generate the list of all files as NUL-terminated names find . -print | wc -l…
Jonas Stein
  • 6,826
  • 7
  • 40
  • 72
67
votes
8 answers

How to run a .NET console application in the background

I have a console application written in C# that is scheduled to run every 15 minutes or so using the built-in Windows Task Scheduler. Every time it runs, the black console box pops up for the duration of its execution and then closes. I am not…
etoisarobot
  • 7,684
  • 15
  • 54
  • 83
66
votes
2 answers

C# How to redirect stream to the console Out?

I found lots of samples how to redirect console output into a file. However I need an opposite solution - I have StreamWriter which I want to be shown in the Console output once I do sw.WriteLine("text");
Boppity Bop
  • 9,613
  • 13
  • 72
  • 151
65
votes
8 answers

System.drawing namespace not found under console application

I selected console application as my C# project. But the imports that seemed to work under Windows Form project don't seem to work here. It says that the drawing namespace does not exist. using System.Drawing; using System.Drawing.Imaging; My…
klijo
  • 15,761
  • 8
  • 34
  • 49
65
votes
7 answers

Using ELMAH in a console application

I just started using ELMAH and am a fan. My team supports a large number of web applications and I'm particularly excited that ELMAH lets us save exceptions from each application to the same MS SQL database table. We also support a few console, DLL…
Michael La Voie
  • 27,772
  • 14
  • 72
  • 92
64
votes
7 answers

Is there a way to format the output format in .NET Core logging?

I'm using the built in logging provider for logging into the console (Microsoft.Extensions.Logging.Console) in a .NET Core console application. Each logging entry produces two lines in the output. I would like to have each entry in one single…
BooFar
  • 857
  • 1
  • 8
  • 15