通过PowerShell查询本机IP地址

脚本内容如下:

Write-Host "本机IP地址为:"(ipconfig|findstr "IPv4")[1].split(":")[1] -ForegroundColor Green
Read-Host "输入任意键退出"

也可以根据你的需求随机应变:

Write-Host "本机IP地址为:"(ipconfig|findstr "IPv4"|findstr "xx.xxx").split(":")[1] -ForegroundColor Green
Read-Host "输入任意键退出"

保存到桌面,右键PowerShell运行:

效果如下:

不要觉得太简单,你磊哥教你的永远都是最实用的。老铁,没毛病。

原文地址:https://www.cnblogs.com/LanTianYou/p/5385796.html