获取完整路径,Windows服务 [英] Getting full path for Windows Service

查看:156
本文介绍了获取完整路径,Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能找出Windows服务.exe文件是动态安装的文件夹?

How can I find out the folder where the windows service .exe file is installed dynamically?

Path.GetFullPath(relativePath);

返回根据的路径C:\ WINDOWS \ SYSTEM32 目录

不过, XMLDocument.load方法(字符串文件名)的方法似乎是对工作在服务.exe文件的安装目录内的相对路径。

However, the XmlDocument.Load(string filename) method appears to be working against relative path inside the directory where the service .exe file is installed to.

推荐答案

尝试

System.Reflection.Assembly.GetEntryAssembly().Location

这篇关于获取完整路径,Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆