redtears

redtears

V2EX 第 30947 号会员,加入于 2012-12-20 08:13:13 +08:00
今日活跃度排名 2866
根据 redtears 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
redtears 最近回复了
16 天前
回复了 cnfczn 创建的主题 宽带症候群 联通 app 越来越下头了
去营业厅问问,把手机和宽带的费用账户绑定到一起,一起缴费,不影响各自的套餐。
36 天前
回复了 lanweizhujiao 创建的主题 游戏 有没有巨好玩的游戏推荐
超级食肉男孩
41 天前
回复了 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'
76 天前
回复了 xiaoniu559 创建的主题 职场话题 如何看待公司推行日报
要黄,快跑
分母+1
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5698 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 02:39 · PVG 10:39 · LAX 19:39 · JFK 22:39
Developed with CodeLauncher
♥ Do have faith in what you're doing.