jameslcs
jameslcs

Reputation: 265

startup folder path for Current user and local machine

How do i get the startup folder path for "Current user" and "All user" in VB.net?

Upvotes: 0

Views: 8627

Answers (2)

giodamelio
giodamelio

Reputation: 5605

Im unclear about exatly what location you want ill give you a wey to get Environment Variables.

Private Function GetEnvironmentVariable(ByVal var As String) As String
    var = Environment.GetEnvironmentVariable(var)
    Return var
End Function

Then pass it the name of the Environment Variable you want. If you are going to add more to the paths like in Rudu's post, you should keep in mind that paths are different of different operating systems.

Upvotes: 0

Mark Hall
Mark Hall

Reputation: 54532

Try

 Environment.GetEnvironmentVariable("ALLUSERSPROFILE")  'All Users Directory'
 Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)) 'Current User Directory'

With the Environment.SpecialFolder enumeration you also have available a Startup and a CommonStartup enumeration. They map to the current user and the all users startup directory.

Upvotes: 2

Related Questions