您的位置:首页 > 其它

WIN服务 winservice 中 获取安装文件所在路径

2012-02-27 11:30 197 查看
如果要获取 服务的安装路径

System.Environment.CurrentDirectory则返回的路径为C:\WINDOWS\system32

上面是服务的路径,不是安装路径

 

//获取当前目录

            string strAssemblyFilePath = Assembly.GetExecutingAssembly().Location;

            string AppPath = Path.GetDirectoryName(strAssemblyFilePath)+ "\\UpdateConfig.xml";

 

这样获取就是正确的安装路径
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  string windows system c