tags:

views:

36

answers:

3

This may be simple but I have brain freeze on just now

If I cd into a directory from a command line and then run my executable VB.net application, is there a way to detect the directory that it was launched from.

I currently have the executable in my PATH however ideally the person would cd into the directory that they were wanting the executable to act upon.

Is this possible?

+1  A: 

IO.Directory.GetWorkingDirectory() will get you the directory you CD'd to.

Adam Ruth
A: 

Environment.CurrentDirectory gives you that information. Note that this property is also assignable, so you can change the current working directory by assigning a new value to it.

Fredrik Mörk
+1  A: 

You can use this Environment.CurrentDirectory.

iburlakov