I’m trying to move some of my routine shell operations from PowerShell to Cygwin, mostly as an educational exercise, but also because I’m really beginning to love some of the Linux flavor tools. I’m still trying work out how to list/manipulate Windows services. PowerShell had some very handy tools for this, such as:
stop-service [pattern]
start-service [pattern]
gsv (or get-service) [pattern]
I work with a lot of custom services lately and would love to not have to switch over to PowerShell to do this in my regular workflow. Has anybody worked this out? Several attempts to google this have been stymied by lots of stuff on how to deal with Cygwin running as a service.
Invoke PowerShell commands from within Cygwin:
And a more general solution would be to create a script
powershell.shwhich contains:After which you can run:
./powershell.sh gsvor whatever commands you need.