Win11开机启动WiFi移动热点脚本Win11设置Wifi热点开机启动

2022-11-20
0评论
/
1176阅读
爱搜啊

Win11作为新一代的操作系统带来了众多新设计,包括可以运行Andorid app以及全新的微软商店等。

Win11还升级了Edge(浏览器)、增强了安全性及Terms聊天功能、表情符号等。微软加入了Auto HDR,它可以大幅度提高颜色范围,使用色彩更加艳丽,因此Win11桌面的视觉体验更好。

Win11设置Wifi热点开机启动

1、管理员打开 Windows PowerShell 输入以下内容:

set-executionpolicy remotesigned

2、打开资源管理器,并在地址栏输入:

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

3、在打开的文件夹下新建 wifi.bat 文件输入以下内容:

powershell -executionpolicy remotesigned -file "%appdata%\Microsoft\Windows\Start Menu\Programs\pondsihotspot.ps1"
exit

4、打开资源管理器,并在地址栏输入:

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

5、在打开的文件夹下新建 pondsihotspot.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) {
"Hotspot is already On!"
}
else{
"Hotspot is off! Turning it on"
Await ($tetheringManager.StartTetheringAsync()) ([Windows.Networking.NetworkOperators.NetworkOperatorTetheringOperationResult])
}

运行 wifi.bat,测试能否打开热点

11(1).png

可以看到win11已Wifi热点自动开启  Win11设置Wifi热点开机自启

相关推荐

win11有选择的启动,不加载系统服务出现你的PIN不可用,单击以重新设置PIN

电信WiFi6路由器JCG-Q20刷机后变砖用ttl救砖无法进uboot的经历

斐讯N1安装Armbian配置与优化部署甜糖程序

斐讯N1打开ADB降级后刷入支持FullCone Nat的Armbian系统并写入eMMC

[非虚拟机]PC电脑上安装Android系统非虚拟机,电脑怎么安装安卓系统?


本站附件分享,如果附件失效,可以去找找看

诚通网盘附件百度网盘附件


标签: Win11 WiFi热点
于2022-11-20发布