How to uninstall a Windows service if the files do not exist anymore? Method 1 – We can use the SC tool (Sc.exe) Open a Command Prompt using windows + R and write Syntax: SC Delete <Service-name-which-you-want-to-delete> Example: we wanted to delete “ABC” service, DESCRIPTION: SC is a command line program used for communicating with the NT Service… Read More »
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.