Install and configure a Windows Service from the command line

In this article I’ll show how to install and configure a Windows Service, query its status and properties, and then how to uninstall it. I’ll be using the command line utilities installutil.exe and sc.exe to install and configure the service. Add a service installer class to your Windows Service project In order to use installutil.exe … Read more

How to use relative paths in a Windows Service

Relative paths are resolved relative to the current working directory. When you’re running a Windows Service, the default working directory is C:\Windows\system32 or C:\Windows\SysWOW64. Therefore relative paths are resolved from these system folders, which can lead to problems when read/writing files. Here are the most common problems you’ll run into: System.IO.DirectoryNotFoundException: Could not find a … Read more