How do i get the startup folder path for "Current user" and "All user" in VB.net?
A:
If you mean the Start \ All Programmes \ Startup
folder, you can use environment varibles
eg All users in DOS
echo %ALLUSERSPROFILE%\Start Menu\Programs\Startup\
eg Current user in DOS
echo %USERPROFILE%\Start Menu\Programs\Startup\
Rudu
2010-10-28 20:48:37
A:
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.
Mark Hall
2010-10-28 21:15:12
How to i get to "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" in my program.
jameslcs
2010-10-29 20:12:24
Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup) This will give you the path you want
Mark Hall
2010-10-29 21:08:09
thanks that what i needed.
jameslcs
2010-10-29 21:54:17
i found out that Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup) is only can be use in .net 4, is there a way to get the path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" for .net 3.5 or lower? thanks.
jameslcs
2010-10-30 05:59:45
Mark Hall
2010-10-30 15:59:31
thanks Mark, i will give it a try.
jameslcs
2010-10-30 17:06:35
A:
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.
giodamelio
2010-10-28 21:20:50