Geo*_*dis 9 hotspot windows-10 wireless-hotspot
出于某种奇怪的原因,我无法使用netsh wlan start hostednetwork
,而是使用 Windows 10 选项“移动热点”。我的问题是我想在启动时自动打开热点,有办法吗?
在我的另一台笔记本电脑上,我netsh
为此使用了 .bat 文件中的命令,但这现在不起作用。我试图运行我在另一台笔记本电脑上使用的相同 .bat 文件,但它失败了。另外,如果我这样做,netsh wlan show drivers
我会得到以下行(除其他外):Hosted network supported : No
需要说明的是,我可以通过 Windows 10 界面正常使用移动热点,我的问题是我想在启动时自动打开它。我搜索了很多,但找不到解决方案...
额外问题:在尝试找出是否可以使用服务(Windows 键 + R => services.msc)执行此操作时,我可能遇到了一些问题(即使我在触摸某些内容时将所有选项都调回了),因为移动热点现在需要在几秒钟后单击两次才能打开。知道如何将所有服务重置为默认值吗?注意:当我将 Windows Mobile 热点服务切换为自动打开时,它没有帮助。
正如在 Superuser 的许多其他答案中提到的,有一种使用 Powershell 命令打开 Windows 10 移动热点的简单方法(它甚至不需要管理员权限)。
参照给出的答案在这里通过@DanceDance -
$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
Run Code Online (Sandbox Code Playgroud)
您可以将它的相关部分添加到 PowerShell 脚本 (PS1) 并通过向任务计划程序添加任务并将触发器设置为“启动时”或“登录时”(在此处阅读更多信息)
这是Microsoft 的关于NetworkOperatorTetheringManager
Class的文档,其中包含一些其他有用的函数,这些函数可能会帮助期待向其 PowerShell 脚本添加附加功能的人们。
shell:startup
并按回车键start_mobile_hotspot.bat
(任何文件名都可以,确保扩展名不会变成.txt.bat
)powershell -ExecutionPolicy Bypass "$connectionProfile = [Windows.Networking.Connectivity.NetworkInformation,Windows.Networking.Connectivity,ContentType=WindowsRuntime]::GetInternetConnectionProfile(); $tetheringManager = [Windows.Networking.NetworkOperators.NetworkOperatorTetheringManager,Windows.Networking.NetworkOperators,ContentType=WindowsRuntime]::CreateFromConnectionProfile($connectionProfile); $tetheringManager.StartTetheringAsync();"
Run Code Online (Sandbox Code Playgroud)
我使用了ManSamVampire 的答案,因为它是启用移动热点的正确方法,并且与网络驱动程序无关,但确保它在启动时运行有点维护成本,因此我结合了/sf/answers/641726711/和/sf/answers/422601721/使这变得快速而简单。
归档时间: |
|
查看次数: |
22327 次 |
最近记录: |