Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get local IPv4 address programmatically on Windows (using Bash and Node)

Get local IPv4 address programmatically on Windows (using Bash and Node)

Requirements:

  • Any shell
  • Node
ip=$(node -e "process.stdout.write(/(?<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\(Preferred\)/.exec(\`$(ipconfig -all)\`).groups.ip)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment