Home All Groups Group Topic Archive Search About

Windows Default Directories

Author
6 Nov 2006 11:01 PM
Elmo Watson
If I was pointing my app to a particular directory, I would just use:
"C:\Whatever\"

But - If I want my app to use one of the Windows default directories
(Desktop, MyDocuments), since they can be different, depending on which
operating system, so how can I define this in code (like - Desktop)?

Author
6 Nov 2006 11:05 PM
Herfried K. Wagner [MVP]
"Elmo Watson" <sput***@yahoo.com> schrieb:
> But - If I want my app to use one of the Windows default directories
> (Desktop, MyDocuments), since they can be different, depending on which
> operating system, so how can I define this in code (like - Desktop)?

Check out 'System.Environment.GetFolderPath'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
7 Nov 2006 1:19 AM
Rich
Using event variables (i.e. %Systemroot% for C:\Windows or \Winnt in
2000) would work well also.

Elmo Watson wrote:
Show quoteHide quote
> If I was pointing my app to a particular directory, I would just use:
> "C:\Whatever\"
>
> But - If I want my app to use one of the Windows default directories
> (Desktop, MyDocuments), since they can be different, depending on which
> operating system, so how can I define this in code (like - Desktop)?