lowerkey
lowerkey

Reputation: 8335

Get Folder from which application was called

I'm writing a program to be called from a folder's context menu that should create a folder in that folder. How do I get the path of that folder, rather than the directory the executable resides in?

Upvotes: 0

Views: 178

Answers (2)

lowerkey
lowerkey

Reputation: 8335

It is in the args. My problem was that calling the application from a shortcut left the current directory at the executable path. Instead I'll just make the application available on path, and then the correct path will be passed in.

Upvotes: 0

wizzardz
wizzardz

Reputation: 5874

Use Environment.CurrentDirectory or AppDomain.CurrentDomain.BaseDirectory to get the path of current working directory.

Upvotes: 2

Related Questions