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
186
votes
15 answers

Why is the console window closing immediately once displayed my output?

I'm studying C# by following the guides in MSDN. Now, I just tried the Example 1 (here is the link to MSDN), and I've encountered an issue: why is the console window closing immediately once displayed my output? using System; public class…
user962206
  • 15,637
  • 61
  • 177
  • 270
186
votes
15 answers

How do I show a console output/window in a forms application?

To get stuck in straight away, a very basic example: using System; using System.Windows.Forms; class test { static void Main() { Console.WriteLine("test"); MessageBox.Show("test"); } } If I compile this with default…
Wil
  • 10,234
  • 12
  • 54
  • 81
172
votes
11 answers

ASP.NET Core configuration for .NET Core console application

ASP.NET Core support a new configuration system as seen here: https://docs.asp.net/en/latest/fundamentals/configuration.html Is this model also supported in .NET Core console applications? If not what is alternate to the previous app.config and…
kimsagro
  • 15,513
  • 17
  • 54
  • 69
170
votes
10 answers

.NET console application as Windows service

I have console application and would like to run it as Windows service. VS2010 has project template which allow to attach console project and build Windows service. I would like to not add separated service project and if possible integrate service…
Tomas
  • 17,551
  • 43
  • 152
  • 257
169
votes
13 answers

How to navigate a few folders up?

One option would be to do System.IO.Directory.GetParent() a few times. Is there a more graceful way of travelling a few folders up from where the executing assembly resides? What I am trying to do is find a text file that resides one folder above…
developer747
  • 15,419
  • 26
  • 93
  • 147
159
votes
13 answers

How to run a C# console application with the console hidden

Is there a way to hide the console window when executing a console application? I am currently using a Windows Forms application to start a console process, but I don't want the console window to be displayed while the task is running.
Aaron Thomas
  • 1,770
  • 2
  • 13
  • 14
128
votes
4 answers

Hide console window from Process.Start C#

I am trying to create process on a remote machine using using System.Diagnostics.Process class. I am able to create a process. But the problem is, creating a service is take a long time and console window is displayed. Another annoying thing is the…
Prasad
  • 1,847
  • 5
  • 21
  • 26
126
votes
20 answers

How can I clear console

As in the title. How can I clear console in C++?
Thomas B
  • 1,289
  • 2
  • 9
  • 5
120
votes
7 answers

Hide Console Window in C# Console Application

The thing is, I really don't want the console window to show up, but the solution should be running. My point here is, I want to keep the application running in the background, without any window coming up. How can I do that?
SOF User
  • 7,590
  • 22
  • 75
  • 121
116
votes
5 answers

What's a good Java, curses-like, library for terminal applications?

I would like to write a Java terminal application that does screen manipulation. Are there any good libraries out there that allow you to manipulate the screen like curses in the *nix/C world? Minimal features I'm looking for are windowing and user…
Francisco Canedo
  • 1,980
  • 2
  • 13
  • 16
111
votes
7 answers

Startup.cs in a self-hosted .NET Core Console Application

I have a self-hosted .NET Core Console Application. The web shows examples for ASP.NET Core but I do not have a web server. Just a simple command line application. Is it possible to do something like this for console applications? public static void…
Daniel
  • 9,491
  • 12
  • 50
  • 66
108
votes
5 answers

.NET console application exit event

In .NET, is there a method, such as an event, for detecting when a console application is exiting? I need to clean up some threads and COM objects. I am running a message loop, without a form, from the console application. A DCOM component that I…
user79755
  • 2,623
  • 5
  • 30
  • 36
103
votes
12 answers

.NET Core console application, how to configure appSettings per environment?

I have a .NET Core 1.0.0 console application and two environments. I need to be able to use appSettings.dev.json and appSettings.test.json based on environment variables I set at run time. This seems to be quite straight forward for ASP.NET Core web…
user2916547
  • 1,963
  • 5
  • 17
  • 21
102
votes
9 answers

How do I find out what directory my console app is running in?

How do I find out what directory my console app is running in with C#?
John Sheehan
  • 77,456
  • 30
  • 160
  • 194
102
votes
3 answers

Only one configSections element allowed per config file and if present must be the first child of the root configuration element

I am developing the console application and when I run the .exe file, I get the following error: system.Configuration.ConfigurationErrorsException: Only one element allowed per config file and if present must be the first child of…
Mahesh
  • 1,465
  • 4
  • 19
  • 23