更新:2007 年 11 月
获取在其中存储应用程序的目录。
' Usage
Dim value As String = My.Application.Info.DirectoryPath
' Declaration
Public ReadOnly Property DirectoryPath As String
返回值
一个 String,它包含应用程序存储于其中的目录。
备注
My.Application.Info.DirectoryPath 属性获取在其中存储应用程序的目录。
示例
此示例使用 My.Application.Info.DirectoryPath 属性来显示其中存储了应用程序的目录路径。
MsgBox("Application directory path: " & My.Application.Info.DirectoryPath)
要求
命名空间:Microsoft.VisualBasic.ApplicationServices
**程序集:**Visual Basic 运行库(位于 Microsoft.VisualBasic.dll 中)
按项目类型列出的可用性
项目类型 |
可用 |
---|---|
Windows 应用程序 |
是 |
类库 |
是 |
控制台应用程序 |
是 |
Windows 控件库 |
是 |
Web 控件库 |
否 |
Windows 服务 |
是 |
网站 |
否 |
权限
以下权限可能是必需的:
权限 |
说明 |
---|---|
控制访问文件和文件夹的能力。关联的枚举:Unrestricted。 |