How do you get the path to the folder the program is in.
Lets say i have something like this:
c:\programs\myprogram\another folder\program.exe
now in my program i want to get the path,
c:\programs\myprogram\another folder\
I tried something like:
System.IO.Path.GetFullPath("\\")
but that just returns c:\
Jeff Gaines - 28 Jan 2007 13:06 GMT
On 28/01/2007 in message
>How do you get the path to the folder the program is in.
>
[quoted text clipped - 9 lines]
>
>but that just returns c:\
FileInfo fInfo = new FileInfo(c:\programs\myprogram\another
folder\program.exe);
string strFolder = fInfo.DirectoryName;

Signature
Jeff Gaines
Patrick F - 28 Jan 2007 13:21 GMT
its not what i am after, i dont know the path. the user takes the program and
put it into a "for me unknown" path on his computer and i need to get the
correct path c:\..... or f:\...
etc
> On 28/01/2007 in message
>
[quoted text clipped - 15 lines]
> folder\program.exe);
> string strFolder = fInfo.DirectoryName;
Oliver Sturm - 28 Jan 2007 13:09 GMT
Hello Patrick,
>I tried something like:
>System.IO.Path.GetFullPath("\\")
>
>but that just returns c:\
You should be fine using Path.GetDirectoryName() for your purpose.
Oliver Sturm

Signature
http://www.sturmnet.org/blog
Otis Mukinfus - 28 Jan 2007 13:33 GMT
>How do you get the path to the folder the program is in.
>
[quoted text clipped - 9 lines]
>
>but that just returns c:\
If you are trying to get the path of your executable application you should use
string path = Application.ExecutablePath;
Good luck with your project,
Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Oliver Sturm - 28 Jan 2007 16:08 GMT
>If you are trying to get the path of your executable application you
>should use
>
>string path = Application.ExecutablePath;
Ah :-) I wouldn't have interpreted the OP's question this way, but now I
think this is probably the right answer!
Oliver Sturm

Signature
http://www.sturmnet.org/blog