How to find windows service exe path

前端 未结 9 2076
一整个雨季
一整个雨季 2020-12-25 09:46

I have a windows service and I need to create directory to store some info. The directory path must be relative to the windows service exe file. How can get this exe file pa

9条回答
  •  难免孤独
    2020-12-25 10:10

    This did the trick for me

    Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);    
    

提交回复
热议问题