轻松几步变开机自动启动(怎么改开机自动启动)

小编:迷魂冰 更新时间:2022-08-29

Win10系统自带了移动热点功能,配备无线网卡的电脑,直接点击移动热点就可以使用手机等设备共享本地网络连接wifi上网了。但是移动热点每次开机都需要再次点击才能打开热点,下面就是如何配置开机自动启动移动热点的方法。

1、鼠标右击Win10屏幕左下角的开始菜单,或者按Win+X弹出隐藏菜单,打开Windows PowerShell(管理员)(A),在Windows11中可以打开 Windows终端(管理员)

2、在打开的Windows PowerShell窗口中输入:set-executionpolicy remotesigned

然后按下回车键确定

轻松几步变开机自动启动(怎么改开机自动启动)

3、确定后将出现如下的提示。输入‘a’然后按下回车键。关闭Windows PowerShell窗口。

轻松几步变开机自动启动(怎么改开机自动启动)

4、在资源管理器地址栏输入:%appdata%\Microsoft\Windows\Start Menu\Programs\Startup 然后按下回车键进入“启动”文件夹,空白处新建一个文本文档,在文本中输入以下内容:

powershell -executionpolicy remotesigned -file "%appdata%\Microsoft\Windows\Start Menu\Programs\开启热点.ps1"

exit

5、关闭并保存文本文档,把文档名称改为“开机启动热点”,后缀名.txt改为.bat。

轻松几步变开机自动启动(怎么改开机自动启动)

6、在资源管理器的地址栏输入:%appdata%\Microsoft\Windows\Start Menu\Programs

然后按下回车键进入“程序”文件夹,在空白处新建一个文本文档,在文档中输入以下内容:

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])

}

7、关闭并保存文本文档,修改文档名称为“开启热点”,后缀名.txt改为.ps1

轻松几步变开机自动启动(怎么改开机自动启动)

8、重启电脑就能开机自动启动移动热点了,如果安装了杀毒软件,记得把“开机启动热点.bat”添加为信任项即可。