Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System directories 1

Status
Not open for further replies.

seanbo

Programmer
Joined
Jun 6, 2003
Messages
407
Location
GB
how can i find out the location of certain sytem directories, such as desktop or user-directory?
 
Use the static function

System.Environment.GetFolderPath

there is also an enumeration which lists the special folders.

System.Environment.SpecialFolder.ApplicationData

Code:
//Gives Desktop
	Debug.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
//Gives My documents
	Debug.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.Personal));

Cheers
 
System.Environment is full of lovelly stuff
 
This is a great solution for some / most of the "special folders". However, I have the need to access one of the "virtual folders". "My Computer" falls into this category - apparently, so does "My Network Places".

I need to be able to programmatically copy files from one "My Network Places" entry to another. Either command line or VB.NET solutions would be acceptable. I cannot find a syntax that would allow this in a DOS command line. Nor can I find out how / where to reference this folder in the .NET framework.

Any help here?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top