Home All Groups Group Topic Archive Search About

Saving a File to the Desktop

Author
12 Apr 2006 1:11 PM
Devlei
I want to be able to save a file to the Desktop.  I realise the Desktop
path varies according to the version of Windows being used. Can
some-one help me with the following three issues:
1.  Is the best option to use 'Environment.OSVersion.Version.Major' to
determine which version of Windows?
2.  What values do each of the Windows versions have for point 1 above?
3.  I know the path for XP (C:\Documents and Settings\" & strUserName &
"\Desktop\) and for Windows 98 (C:\Windows\Desktop\), but can anyone
help me what the paths for the other Windows versions would be?

With thanks

Author
12 Apr 2006 1:26 PM
Herfried K. Wagner [MVP]
"Devlei" <dev***@eastcape.net> schrieb:
>I want to be able to save a file to the Desktop.  I realise the Desktop
> path varies according to the version of Windows being used.
>[...]
> 3.  I know the path for XP (C:\Documents and Settings\" & strUserName &
> "\Desktop\) and for Windows 98 (C:\Windows\Desktop\), but can anyone
> help me what the paths for the other Windows versions would be?

'Environment.GetFolderPath(Environment.SpecialFolder.Desktop)' should return
the correct path on all versions of Windows supported by the .NET Framework.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
12 Apr 2006 1:32 PM
cSharpLess
"Devlei" <dev***@eastcape.net> kirjoitti
viestissä:1144847469.752733.28***@j33g2000cwa.googlegroups.com...
>I want to be able to save a file to the Desktop.

Just use

Dim deskDir As String =
Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)

That should give you desktop folder.