通过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运行:

效果如下:

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

posted @ 2016-04-13 09:38  天外归云  阅读(1479)  评论(0编辑  收藏  举报