win10开机自动开热点
1。新建一个hotspot.ps1的文件文件。 输入以下内容
$connectionProfile = [Windows.Networking.Connectivity.NetworkInformation,Windows.Networking.Connectivity,ContentType=WindowsRuntime]::GetInternetConnectionProfile()
$tetheringManager = [Windows.Networking.NetworkOperators.NetworkOperatorTetheringManager,Windows.Networking.NetworkOperators,ContentType=WindowsRuntime]::CreateFromConnectionProfile($connectionProfile)
# Start Mobile Hotspot
$tetheringManager.StartTetheringAsync()
# Stop Mobile Hotspot
#$tetheringManager.StopTetheringAsync()
# Check whether Mobile Hotspot is enabled
$tetheringManager.TetheringOperationalState
然后创建hotspot.ps1的快捷方式,复制快捷方式到
%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup文件夹里即可。
重启电脑就会自动启动移动热点了。
如果遇到ps1文件打开没有正常运行。 尝试以管理员身份启动powershell. 在打开的powershell命令行输入 Set-ExecutionPolicy RemoteSigned 输入y,然后再运行脚本hotspot.ps1
看是否执行成功。成功时移动热点已经打开。
自动启动移动热点的脚本已经放到github.
参考链接
https://superuser.com/a/1472550/468605