Server.MapPath("~") "\" "Web.config"Server.MapPath("~") 是取当前目录上一级的路径Server.MapPath(".") 是取当前目录的路径
先用System.IO.Directory.GetDirectories函数获取子目录的名称(包括其路径),再用System.IO.Path.GetFileName获取子目录的名称.下面是代码:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
For Each s In System.IO.Directory.GetDirectories("C:\Windows")
Console.WriteLine(System.IO.Path.GetFileName(s))
Next
End Sub
下面是部分输出:
Application Data
AppPatch
assembly
BOCNET
Boot
Branding
ConfigSetRoot
Cursors
Debug
DigitalLocker
Downloaded Installations
Downloaded Program Files
ehome
en-US
Fonts
Globalization
Help
...
可能有更简洁的方法,你可以到MSDN看看
System.IO.Directory.GetDirectories:
System.IO.Path.GetFileName:
通用 I/O 任务:
你这个问题分着问兴许能快点得到答案.
我只知道一点,软件已打开,可以根据进程信息判断
Private chm_process As Process
If IsNothing(chm_process) OrElse chm_process.HasExited Then
chm_process = New Process
chm_process.StartInfo.FileName = Application.StartupPath ◆ "\软件使用说明书.CHM"
chm_process.Start()
Else
WinAPI.ShowWindowEx(chm_process.MainWindowHandle, WinAPI.nCmdShow.SW_RESTORE)
End If
让cad加载文件得找API,不知道有没有
命名空间:System.Windows.Forms
Application.StartupPath 属性(返回String)
获取启动了应用程序的可执行文件的路径,不包括可执行文件的名称.
Application.ExecutablePath 属性(返回String)
获取启动了应用程序的可执行文件的路径,包括可执行文件的名称.
System.Environment.CurrentDirectory
这才是vb.net的获取程序运行路径的方法
①.、如果你的窗体就是你当前工程这个EXE本身的窗体,
那么窗体所在的路径就是工程的启动路径,用下面的语句获取:
AppPath=Application.StartupPath
以上就是土嘎嘎小编为大家整理的vb.net获取应用目录相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!