Open E-School

Male
Friday, February 24, 1984

Console.Title - How to change / set console window title using C#

Category: Programming Date: Monday, March 23, 2015

Goal

Learn how to change the default title of the console window using C#.

Namespaces used

System – Console class is defined in the System namespace

Classes used

Console

Properties used

Console.Title – Static property defined in the Console class

Brief description

When you start writing console applications using C# you notice that the title of the console window by default is the absolute path of your application. It might seem very un-meaningful to you and you will want to set the title of the console application to some logical text which will go nicely with your application. In this article you will learn how to change / set the title of the console window using C#
 

Console.Title Output 1

Code

using System;

namespace ConsoleApplication1
{
    class Program
    {
        public static void Main(string[] args)
        {
            Console.Title = "My new console title...";
        }
    }
}

Output

Console.Title Output 2

 
Explanation of the code

We have used the Console.Title property to set a new title for our console window. As you can see in the output above the string which we are setting in the code shows up in the title for the console window.

Extra remarks

Console.Title is a read and write property. You can read the existing title of the console window and also set a new title. This way you can write logic in your application to change the title of the console window for different situations.

Rate this article and help us improve

Please Login to rate
Overall ratings: 0 | Rating: out of 5
Previous Article Next Article

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp