Languages
[Edit]
EN

C# / .NET - get current working directory

14 points
Created by:
Root-ssh
6550

In C# / .NET it is possible to get current working directory name in following way.

Directory.GetCurrentDirectory method example

string  directory = Directory.GetCurrentDirectory();

Console.WriteLine("Current working directory: " + directory);

Output:

Current working directory: C:\Users\myuser\source\repos\Test\bin\Debug\netcoreapp2.1

References

  1. Directory.GetCurrentDirectory Method - Microsoft Docs
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.