.net - 如何找到在运行时作为 Windows 服务运行的 exe 的位置?

标签 .net windows-services

如何在运行时找到作为 Windows 服务运行的 exe 的位置?

最佳答案

使用注册表查找:

例如

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\' + ServiceDisplayName;

然后读取ImagePath值。

关于.net - 如何找到在运行时作为 Windows 服务运行的 exe 的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/298669/

相关文章:

powershell - Windows Powershell - 如何仅在某些 Windows 服务发生变化时重新显示它们的状态?

c# - 安装时自动启动 Windows 服务

azure - 在 Windows Azure 上安装 Windows 服务的最佳实践

c++ - 等待服务启动/停止

c# - Dot Net Core 和 Azure 存储 : Could not load file or assembly System, 版本=4.0.0.0

c# - 强类型在 .NET Framework 中意味着什么?

对象的 C# 流程图

windows - 在 Windows 服务中存储配置数据的推荐方法是什么?

c# - Builders<TA>.Update.Set() 如何处理并行访问?

.net - 托管 Windows 工作流设计器