开发者

Visual Basic how to get to %appdata%

开发者 https://www.devze.com 2023-03-30 01:01 出处:网络
I\'m working on a project in Visual Basic and it\'s going to store all the data in a folder in %appdata%. I\'m using Visual Studio 2010 I already tried this:

I'm working on a project in Visual Basic and it's going to store all the data in a folder in %appdata%. I'm using Visual Studio 2010 I already tried this:

My开发者_如何学Go.Computer.FileSystem.CreateDirectory(Environment.ExpandEnvironmentVariables(%AppData%\test"))

but it didn't work.


Using VB.NET, you can find them conveniently located in the My namespace at:

My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData
My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData

Check out the MSDN documentation for more paths.


Dim filePath As String

filePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\test"
0

精彩评论

暂无评论...
验证码 换一张
取 消