Skip to content

Instantly share code, notes, and snippets.

@mayrund
Last active November 19, 2016 19:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mayrund/d7c0678821a17f2fc4aec502397836ca to your computer and use it in GitHub Desktop.
Save mayrund/d7c0678821a17f2fc4aec502397836ca to your computer and use it in GitHub Desktop.
Windows Get Port by Process Name
for /f "tokens=2 delims=," %F in ('tasklist /nh /fi "imagename eq sqlservr.exe" /fo csv') do netstat -oan | findstr %~F
(Note: Please replace % with %% when running in Batch file instead of Command Line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment