Tag: Console

How to Get the Application’s path in Windows or Console Application in C#?

There are times when you want to retrieve the application’s path where the exe is running to get access to another file or accessing the configuration file etc. Below is a sample program that demonstrates how one can retrieve the Application’s path in Windows or Console Application in C#. How to Get the Application’s path in Windows or Console Application in C#?

How do Specify the Exit Code of Console Application in .NET?

There are times when you want to specify the exit code from the Main function for example when working on the Console Application in .NET . How do Specify the Exit Code of Console Application in .NET? You can use the Environment.Exit to specify the exit code in the Console Application.

How to get the Computer Name in C# ?

When working on a Winforms or Console application using C# , sometimes you might need to get the computer name where the application is running. How to get the Computer Name in C# ? To retrieve the computer name , one can use the System.Environment.MachineName property as shown below.