怎么得到当前运行的程序的名字阿?

devil_li 2003-08-13 03:36:24
怎么得到当前运行的程序的名字阿?
就是应用程序跑的时候得到自己的程序文件名
比如当前运行的程序是C:\temp\aaa.exe
我要返回"aaa",应该怎么做?
...全文
34 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
river168 2003-08-13
  • 打赏
  • 举报
回复
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
CloneCenter 2003-08-13
  • 打赏
  • 举报
回复
上面写错了,是 System.IO.Path...
CloneCenter 2003-08-13
  • 打赏
  • 举报
回复
可以用 System.Path.IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)获取不包含扩展名的文件名。
CloneCenter 2003-08-13
  • 打赏
  • 举报
回复
Application.ExecutablePath
devil_li 2003-08-13
  • 打赏
  • 举报
回复
看来只有这样了:
Imports System.Windows.Forms
Function GetAppName() As String
Dim s As String
s = Application.ExecutablePath
s = s.Substring(s.LastIndexOf("\") + 1)
s = s.Substring(0, s.IndexOf("."))
Return s
End Function
devil_li 2003-08-13
  • 打赏
  • 举报
回复
AppDomain没有FriendlyName方法阿
river168 2003-08-13
  • 打赏
  • 举报
回复
AppDomain.FriendlyName

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧