Proxy a port on Windows

Edit
Created: 2022/5/21
Updated: 2022/5/21

One-liner to expose a localhost-only port (especially for WSL2).

netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=localhost