I've found many questions/answers that document how to kill a Windows process in Cygwin, but I'm asking how to kill a Windows 10 service in Cygwin.
If the verb "kill" seems out of place for a Windows service, I'm referring to the effect you get by highlighting it in the Task Manager and pressing the delete key.
(I don't know if this is of any significance, but as you can see from the screenshot, this particular service is under the "Background processes" section of the task manager, it's within "Program Files", and it is a standalone .exe. Most of the other services I see are in the "Windows processes" section, within "System32", and run via arguments to the svchost.exe command, respectively.)
I can find the service's process ID by running this command in cygwin: wmic service get ProcessID, Name, State /format:csv | tr -d '\r' | grep -i -- 'service name':
DESKTOP,ServiceNameLoggerService,0,Stopped
DESKTOP,ServiceNameSvc,19724,Running
But I get an unhelpful message if I attempt to kill it:
$ /bin/kill -f -W 19724
kill: couldn't open pid 19724
I am able to kill normal Windows processes that command, but not this one.
In your answer, it's okay if a Windows command kills the service, so long as that command runs within a Cygwin terminal and doesn't require me to start the terminal with admin access*.
*: The reason I don't want to start Cygwin with admin access is because I'm running my Cygwin terminal in VS Code. According to my research, the integrated terminal has the same permissions as VS Code, which I'm starting as a regular user. I could start VS Code as an admin, but this has undesirable side effects. For example, you can't upgrade VS Code in admin mode.
Elsewhere, official sources say:
The integrated terminal shell is running with the permissions of VS Code. If you need to run a shell command with elevated (administrator) or different permissions, use platform utilities such as
runas.exewithin a terminal.
I spent an hour trying to figure out how to get runas.exe to work in Cygwin with no luck. No consistent luck, anyway. It seemed to randomly tell me my username/password was invalid the majority of the time.
Besides, I create and kill Cygwin terminals frequently, and the pop-up asking me to confirm if I want to run in Admin mode would have a negative effect on my productivity. (Maybe there's a way to disable this per app, in which case, this would be a moot point.)

