VB.NET | Get current user profile folder

vb.net

Solution

Use the 'userprofile' environment variable...

MsgBox(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile))

Problem

How can I use `'path'` to go to the user's current profile? For example, I have this code: ``` Dim fso, fldr fso = CreateObject("Scripting.FilesystemObject") fldr = fso.GetFolder("C:\Documents and Settings\%UserProfile%\Local Settings\TEST") 'delete subfolders For Each subf In fldr.SubFolders subf.Delete(True) Next 'delete subfiles For Each fsofile In fldr.Files fsofile.Delete(True) Next ``` I've tried this way and the path is unknown. How can I make `C:\Documents and Settings\???\Local Settings\TEST` to go to the current user's folder?

Original source

Related problems