Joshua's Docs - Windows CMD and Batch Snippets

Get file contents of a zip folder

If you have git-bash installed, you can just use zipinfo:

zipinfo -1 myZipFolder.zip

Else, if you 7z installed (or Peazip, which comes bundled with it) you can use it from the CLI with something like (in same folder as zip):

"C:\Program Files\PeaZip\res\7z\7z.exe" l %cd%/myZipFolder.zip

Kill processes by port

First, here is my complicated solution:

netstat -nao | grep ":PUT_PORT_HERE" | sed -E -n "s/^([\s\w]|.)*\s([0-9]{2,}+)($|[\r\n]).*/\2/p" | xargs -n 1 taskkill //F //PID

Warning: Requires git-bash, or something that provides sed, grep, and xargs.

And now, here is a StackOverflow question that provides some... more simple... responses.

Markdown Source Last Updated:
Fri Aug 07 2020 06:12:47 GMT+0000 (Coordinated Universal Time)
Markdown Source Created:
Thu Oct 17 2019 18:26:33 GMT+0000 (Coordinated Universal Time)
© 2024 Joshua Tzucker, Built with Gatsby
Feedback