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
35
votes
5 answers

How to add App.Config file in Console Application

I want to store the connection string and some parameters in app.config file which we generaly do for windows aplication but I can't find app.config file for console application. So how should I use this file, how to add this file or there is some…
Nits
  • 883
  • 4
  • 15
  • 30
35
votes
3 answers

How to receive Plug & Play device notifications without a windows form

I am trying to write a class library that can catch the windows messages to notify me if a device has been attached or removed. Normally, in a windows forms app I would just override the WndProc method but there is not WndProc method in this case.…
PICyourBrain
  • 9,976
  • 26
  • 91
  • 136
35
votes
1 answer

How to get Doctrine ORM instance in Symfony2 console application?

Possible Duplicate: How can i inject dependencies to Symfony Console commands? I want to make console application, which changes some records from the database (using Cron, every hour). How to get Doctrine ORM instance here? In casual controller,…
pamil
  • 980
  • 2
  • 10
  • 20
34
votes
10 answers

How do I compile my App.config into my exe in a VS2010 C# console app?

I'm creating a console app in Visual Studio 2010 with c#. I want this app to be stand alone, in that all you need is the exe, and you can run it from anywhere. I also want to use app.config to store connection strings and so on. My problem is that…
Patches
  • 1,115
  • 1
  • 10
  • 13
34
votes
2 answers

How to enforce required command-line options with NDesk.Options?

I was just writing a console utility and decided to use NDesk.Options for command-line parsing. My question is, How do I enforce required command-line options? I see in the docs that: options with a required value (append '=' to the option name)…
BigJoe714
  • 6,732
  • 7
  • 46
  • 50
34
votes
6 answers

Redirect Console.Write... Methods to Visual Studio's Output Window While Debugging

From a Console Application project in Visual Studio, I want to redirect Console's output to the Output Window while debugging.
AMissico
  • 21,470
  • 7
  • 78
  • 106
33
votes
3 answers

Generic way to exit a .NET application

I understand that there are a few ways to exit an application, such as Application.Exit(), Application.ExitThread(), Environment.Exit(), etc. I have an external "commons" library, and I'm trying to create a generic FailIf method that logs the…
michael
  • 14,844
  • 28
  • 89
  • 177
33
votes
2 answers

showing percentage in .net console application

I have a console app that performs a lengthy process. I am printing out the percent complete on a new line, for every 1% complete. How can I make the program print out the percent complete in the same location in the console window?
Ronnie Overby
  • 45,287
  • 73
  • 267
  • 346
32
votes
8 answers

Debugging: Attach to Process for Console App running inside cmd.exe

How do you "Attach to Process..." for a console application thats running from a CMD window and not launched by F5? The reason I ask is because the application takes command line arguments and I want to have a genuine experience. I've even…
Chris
  • 6,702
  • 8
  • 44
  • 60
32
votes
7 answers

HttpUtility.UrlEncode in console application

I'd like to use HttpUtility.UrlEncode in a console application, VB.NET, VS 2010 Beta 2. System.Web.HttpUtility.UrlEncode(item) Error message: 'HttpUtility' is not a member of 'Web'. In this question Anjisan suggests to add a reference to…
George
  • 1,111
  • 3
  • 20
  • 38
32
votes
6 answers

Avoiding "Press any key to continue" when running console application from Visual Studio

When running a console application in Visual Studio via "Start without Debugging" (Ctrl+F5), the console remains open at the end of the run asking to Press any key to continue . . . thus requiring to activate the window and hit a key. Sometimes…
citykid
  • 9,916
  • 10
  • 55
  • 91
31
votes
10 answers

How to run console application from Windows Service?

I have a windows service, written in c# and I need to run a console application from it. Console application also written in c#. Console application is running fine when it is run not from windows service. When it is ran from ws it doesn`t do…
Yaroslav Yakovlev
  • 6,303
  • 6
  • 39
  • 59
31
votes
2 answers

How can I copy a string to the clipboard within my console application WITHOUT adding a reference to System.Windows.Forms?

I have a .NET 4.0 console application that generates SQL and stores it in a string variable. I want this string to be copied directly to the clipboard. So far, all my research indicates that the ONLY way this can possibly be done is by adding a…
oscilatingcretin
  • 10,457
  • 39
  • 119
  • 206
31
votes
6 answers

How can a C# Windows Console application tell if it is run interactively

How can a Windows console application written in C# determine whether it is invoked in a non-interactive environment (e.g. from a service or as a scheduled task) or from an environment capable of user-interaction (e.g. Command Prompt or PowerShell)?
Jeff Leonard
  • 3,284
  • 7
  • 29
  • 27
31
votes
5 answers

How can I obtain the named arguments from a console application in the form of a Dictionary?

I have a console application called MyTool.exe What is the simplest way to collect the named arguments passed to this console applicaiton and then to put them in a Dictionarty() which will have the argument name as the key and the…
pencilCake
  • 51,323
  • 85
  • 226
  • 363