how to access current directory in windows service

By | May 3, 2018

Path.GetDirectoryName(Application.ExecutablePath); will return the current directory in windows service.

To work above code you need to add one dll reference System.Windows.Forms.dll. 

Some developers tries Directory.GetCurrentDirectory(), which actually returns C:\Windows\System32.

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *