I tried to determine current running directory of my C# console application using the following code:
Assembly.GetExecutingAssembly().Location
However that code returns path to assembly location. It may be different from the folder where EXE file is located.
My console application parses logs with no parameters. I want to know the path to the logs/
folder inside of the current executable's folder. Please help!
In the ASP.NET. Have you ever wanted to get the directory for the executing Console Application in C#? The following method will do so, and is the equivalent of Application.StartupPath when working with Windows Forms.
System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
You can use following method:
System.Reflection.Assembly.GetExecutingAssembly().Location
Hi
you can use "Directory.GetCurrentDirectory" to get the current working directory of the application.
FavScripts.com is a free tool to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.
Boost your productivity with FavScripts.com!