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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get %userprofile% in c# help please

Status
Not open for further replies.

iis6newbie

Technical User
Nov 22, 2003
54
US

Hello all,

can you give a me function name that I can use to get the
%userprofile% (user's path) in C#?


Thanks
 
Use Environment.GetFolderPath, passing in one of the SpecialFolder enumeration values.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks,

I found the solution.

<SCRIPT LANGUAGE=VBScript>
Dim sMyDocumentsFolder,wshShell
Set WshShell = CreateObject("Wscript.Shell")

'Get My Documents Folder
sMyDocumentsFolder = WshShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Local Settings\Temporary Internet Files\"
document.write sMyDocumentsFolder
msgBox(sMyDocumentsFolder)
</SCRIPT>
 
Uhh, that's VBScript, not C#, like you specified in your earlier post.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top