开关WI-Fi显示列表

Posted on 2019-04-03 19:25  努力成长静待花开  阅读(153)  评论(0编辑  收藏  举报

实现效果:

  

使用方法:

  Show-NetList     #显示Wi-Fi列表

  Show-NetList -off #关闭显示 (如图) 

实现代码:

function Show-NetList
{
    Param([switch]$off)
    $arg=if($off.IsPresent){"add"}else{"delete"}
    netsh wlan $arg filter permission=denyall networktype=infrastructure >Out-Null
}