Reputation: 38228
I created a console app, I put its shortcut in sendto
directory.
Now I select in some OTHER directory a list of files to sendto
shortcut and want to know what this other directory is.
I tried many things like Directory.GetCurrentDirectory
and Environment.CurrentDirectory
but it returns the path of my exe
not the other directory where I selected my files.
So do you know how ?
Upvotes: 0
Views: 69
Reputation: 39530
You need to look at the pathname(s) of the files being passed to your application by Windows.
From Windows PoV, there's nothing special about the directory the files are in; Windows is just passing the path of those files to your app. As the commenter above says, you can use members of the Path class to manipulate the paths and extract a directory name, if that's what you want.
There are three separate concepts here:
Upvotes: 1
Reputation: 496
Add to reference Windows.Forms:
using System.Windows.Forms;
and:
Application.StartupPath
Upvotes: 0