Skip to content

Instantly share code, notes, and snippets.

@bcalmac
Created March 17, 2015 18:18
Show Gist options
  • Save bcalmac/58bde8f402aa0d82b92d to your computer and use it in GitHub Desktop.
Save bcalmac/58bde8f402aa0d82b92d to your computer and use it in GitHub Desktop.
Bash functions to start/stop/restart multiple services on Windows
# start the services passed as arguments
function nst { for s in "$@"; do net start $s; done }
# stop the services passed as arguments
function nsp { for s in "$@"; do net stop $s; done }
# restart the services passed as arguments
function nrs {
# Stop in reverse order
for ((i=$#; i>0; i--)); do net stop ${!i}; done
for s in "$@"; do net start $s; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment