redtears

redtears

V2EX 第 30947 号会员,加入于 2012-12-20 08:13:13 +08:00
今日活跃度排名 7844
根据 redtears 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
redtears 最近回复了
4 天前
回复了 lanweizhujiao 创建的主题 游戏 有没有巨好玩的游戏推荐
超级食肉男孩
8 天前
回复了 baiyumo00 创建的主题 优惠信息 远程看看 AnyViewer 新增一年激活码
已用,有效,感谢
8 天前
回复了 zhangtw2024 创建的主题 Android 出 HP Elite Dragonfly Chromebook
省流:1988
https://learn.microsoft.com/en-us/answers/questions/2074409/resolved-how-to-toggle-wi-fi-in-windows-11-via-the
```shell
[CmdletBinding()] Param (
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$Status
)

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
}
[Windows.Devices.Radios.Radio,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
[Windows.Devices.Radios.RadioAccessStatus,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ([Windows.Devices.Radios.Radio]::RequestAccessAsync()) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
$radios = Await ([Windows.Devices.Radios.Radio]::GetRadiosAsync()) ([System.Collections.Generic.IReadOnlyList[Windows.Devices.Radios.Radio]])
$wifiRadio = $radios | ? { $_.Kind -eq 'WiFi' }
[Windows.Devices.Radios.RadioState,Windows.System.Devices,ContentType=WindowsRuntime] | Out-Null
Await ($wifiRadio.SetStateAsync($Status)) ([Windows.Devices.Radios.RadioAccessStatus]) | Out-Null
```
以上代码保存为 ToggleWifiRadio.ps1
# Turn off
PS D:\path\to\your\folder> .\ToggleWifiRadio.ps1 -Status 'Off'

# Turn on
PS D:\path\to\your\folder> .\ToggleWifiRadio.ps1 -Status 'On'
44 天前
回复了 xiaoniu559 创建的主题 职场话题 如何看待公司推行日报
要黄,快跑
分母+1
45 天前
回复了 nathadai 创建的主题 分享发现 谨慎购买零刻产品,谨慎 AllInOne 玩机
哪家的小主机比较不错呢?
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1418 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 17:17 · PVG 01:17 · LAX 09:17 · JFK 12:17
Developed with CodeLauncher
♥ Do have faith in what you're doing.