Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ip获取不准确 #8

Open
zhangjiashuo1234 opened this issue Mar 27, 2024 · 1 comment
Open

ip获取不准确 #8

zhangjiashuo1234 opened this issue Mar 27, 2024 · 1 comment

Comments

@zhangjiashuo1234
Copy link

windows脚本中获取ip的方式,是通过ipconfig获取的,当电脑有多个网卡的时候就不能准确获取ip,可以通过路由表的方式获取测下来算是比较准确的,如下:

$ip = ((route print |findstr "0.0.0.0.*0.0.0.0") -replace "\s{2,}", " ").split()[4]

@tangjie1
Copy link
Owner

是的是的,学习了,非常感谢~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants