2011年6月24日
摘要: 查看文章如何获取Windows服务对应程序的所在目录?2008-01-18 13:21在WinForm程序中,通常会采用Environment.CurrentDirectory来获取应用程序的当前目录,可是在Windows服务中,这种方式获取的是C:\Windows\System32,而我的服务是安装在D:\ABC目录下的,服务程序的名称为Test.exe。可以采用以下方式:System.AppDomain.CurrentDomain.BaseDirectory获取的结果为:d:\abc\System.Reflection.Assembly.GetExecutingAssembly().Loc 阅读全文
posted @ 2011-06-24 16:22 赵保龙 阅读(257) 评论(0) 推荐(0) 编辑