Jeffrey Chen
Jeffrey Chen

Reputation: 77

how to get the path in a .NET console application

For example I have a console application named "myconsole.exe" which path is C:\temp\app\myconsole.exe
I added "C:\temp\app" to the PATH environment variable, Now I open the command prompt, type CD C:\MyProjects and run myconsole, how can I get the path "C:\MyProjects" in myconsole.exe?
enter image description here

Upvotes: 0

Views: 477

Answers (1)

nevermind
nevermind

Reputation: 2438

Directory.GetCurrentDirectory method is what you are looking for.

Upvotes: 2

Related Questions