How to get the startup path in console app in C#?
To get the startup path in console app in C#, we useSystem.Reflection.Assembly.GetExecutingAssembly().Location
Combined with System.IO.Path.GetDirectoryName
Example
using System;
using System.IO;
public class Example
{
public static void Main()
{
var GetDirectory =
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
Console.WriteLine(GetDirectory);
}
}