0

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?

lowerkey
  • 8,105
  • 17
  • 68
  • 102
  • 1
    http://stackoverflow.com/questions/3271326/get-directory-where-executed-code-is-located? – Jon Malcolm Dec 07 '12 at 11:39
  • The title of that question is exactly what I'm not looking for. I don't want to find out where the application is located, but where the application was called from. – lowerkey Dec 07 '12 at 11:44

2 Answers2

2

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

wizzardz
  • 5,664
  • 5
  • 44
  • 66
0

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.

lowerkey
  • 8,105
  • 17
  • 68
  • 102