如何更改 Windows 8.1 中 WiFi 網路的順序以優先考慮一個網路?

如何更改 Windows 8.1 中 WiFi 網路的順序以優先考慮一個網路?

在 Mac OS X 中,您可以透過在清單中上下移動來變更記住的無線網路的順序。這將更改首先連接的 WiFi 網路。

我似乎在 Windows 8.1 中找不到等效的設定。如何更改設定以便優先選擇特定網路而不是其他網路?

謝謝。

答案1

不幸的是,Windows 8 缺乏 GUI 方式來執行此操作。

  1. 在提升的(管理)命令提示字元中執行以下命令以查看可用的無線網路及其目前優先順序:

    netsh wlan show profiles
    

    1

  2. 記下介面和無線網路的名稱,並使用以下命令變更後者的優先權:

    netsh wlan set profileorder name="w1r3l3$$" interface="Wi-Fi" priority=1
    
  3. 再次運行netsh wlan show profiles將顯示更改後的順序。

來源

自然地,人們已經製作了 GUI 來克服這種荒謬的遺漏,所以你可以使用類似的東西WiFi 設定檔管理器 8反而:

2

答案2

我編寫了一個腳本以允許用戶使用記事本對其進行編輯:

# Prioritize WLAN networks

# Prepare the temporary file
$tempfile = "$($Env:Temp)\wifiprio.txt"
Set-Content -Path $tempfile -encoding UTF8 @"
# Edit (re-arrange) the list of networks, putting the highest priority at the top.
# Empty lines and lines starting with # will be ignored.
#
"@

# Add the network list to the file
& netsh wlan show profiles | Where-Object {$_ -match(":")} | ForEach-Object {(($_.split(":"))[1]).trim()} | Out-File $tempfile -encoding UTF8 -Append

# Allow the user to edit the list
Start-Process -FilePath "notepad.exe" -ArgumentList $tempfile -PassThru -Wait

# Get the edited list
$networks = Get-Content $tempfile | Where-Object {$_ -notmatch "^\s*#"} | Where-Object {$_ -notmatch "^\s*$"}

# Clean up
Remove-Item $tempfile 

# Set priority according to the edited list
$priority = 1
ForEach ($network in $networks)
{
    & netsh wlan set profileorder name="$($network)" interface="Wi-Fi" priority=$priority
    $priority += 1
}

相關內容