I've implemented a Windows Service with custom commands overriding OnCustomCommand method.
I can access these custom commands from another .net application with:
ServiceController Controller = new ServiceController("MyWindowsService");
if (Controller.Status == ServiceControllerStatus.Running)
{
Controller.ExecuteCommand(128);
}
But, can I access these custom commands from the command line (cmd) the same way I can start/stop/... the service?
EDIT: (Without creating a middleware application to handle the service, just with standard tools)
You can use the Service Control command line tool
sc
(Under the hood everything is using Win32's
ControlService
API.)