windows10/windows11实现开机自动打开热点wifi

您所在的位置:网站首页 电脑开热点命令怎么设置 windows10/windows11实现开机自动打开热点wifi

windows10/windows11实现开机自动打开热点wifi

2024-07-12 09:50| 来源: 网络整理| 查看: 265

在这里插入图片描述

鼠标右击屏幕左下角的开始菜单,打开 Windows PowerShell(管理员),或者使用win+x快捷键

在打开的Windows PowerShell窗口中输入命令回车,出现提示,输入a回车(Enter按键)然后关闭窗口

set-executionpolicy remotesigned

找个地方新建一个文件夹名字自己取,里面新建3个txt文件,名字分别改成:(后缀名一起改)wifi.vbs wifi.bat wifi.ps1

右键文件 wifi.ps1 打开方式 选择记事本打开,复制下面内容粘贴进去保存并关闭

Add-Type -AssemblyName System.Runtime.WindowsRuntime $asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0] Function Await($WinRtTask, $ResultType) { $asTask = $asTaskGeneric.MakeGenericMethod($ResultType) $netTask = $asTask.Invoke($null, @($WinRtTask)) $netTask.Wait(-1) | Out-Null $netTask.Result } Function AwaitAction($WinRtAction) { $asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and !$_.IsGenericMethod })[0] $netTask = $asTask.Invoke($null, @($WinRtAction)) $netTask.Wait(-1) | Out-Null } $connectionProfile = [Windows.Networking.Connectivity.NetworkInformation,Windows.Networking.Connectivity,ContentType=WindowsRuntime]::GetInternetConnectionProfile() $tetheringManager = [Windows.Networking.NetworkOperators.NetworkOperatorTetheringManager,Windows.Networking.NetworkOperators,ContentType=WindowsRuntime]::CreateFromConnectionProfile($connectionProfile) if ($tetheringManager.TetheringOperationalState -eq 1) { "" } else{ Await ($tetheringManager.StartTetheringAsync()) ([Windows.Networking.NetworkOperators.NetworkOperatorTetheringOperationResult]) }

按照上面方法打开文件 wifi.bat ,复制下面内容粘贴进去

powershell -executionpolicy remotesigned -file "wifi.ps1" exit

打开文件 wifi.vbs ,复制下面内容粘贴进去 (末尾的0就是运行时隐藏cmd窗口,改成1就是不隐藏)

set ws=WScript.CreateObject("WScript.Shell") ws.Run "wifi.bat",0

右键文件 wifi.vbs 创建快捷方式

打开资源管理器(此电脑),在地址栏输入下面地址,进入文件夹把 wifi.vbs 的快捷方式放进去

%appdata%\Microsoft\Windows\Start Menu\Programs\Startup

这样每次开机电脑就会自动打开热点wifi了



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3