fix(v1.0.2): suppress netsh output to avoid mojibake on RU console

netsh emits in the OEM code page (CP866 on RU Windows); the modern console showed it as 'DHCP ╤Г╨╢╨╡ ╨▓╨║╨╗╤О╤З╨╡╨╜╨╛...'. Our own English Setting/Done lines remain, and Get-NetIPAddress already prints proper Unicode.
This commit is contained in:
Engelgardt23 2026-05-17 18:10:09 +03:00
parent e80e673a10
commit 67447bc7f1
2 changed files with 9 additions and 5 deletions

View file

@ -6,6 +6,10 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
## [Unreleased]
## [1.0.2] - 2026-05-17
### Fixed
- Suppress `netsh` output to avoid mojibake on non-UTF-8 consoles (Russian Windows printed `╤Г╨╢╨╡ ╨▓╨║╨╗╤О╤З╨╡╨╜╨╛...` because netsh emits in the OEM code page). Our own English status lines remain; the post-change `Get-NetIPAddress` block already prints Unicode.
## [1.0.1] - 2026-05-17
### Changed
- Dropped the `made by engelgardt` line from the startup banner — keep author credit in the README only.

View file

@ -1,7 +1,7 @@
# netswitch v1.0.0 - quick NIC IP / DHCP toggle
# made by engelgardt
$NetswitchVersion = '1.0.1'
$NetswitchVersion = '1.0.2'
$GithubRepo = 'Engelgardt23/netswitch'
$ErrorActionPreference = 'Stop'
@ -107,8 +107,8 @@ if ($modeChoice.Trim() -eq '2') {
# --- DHCP ---
Write-Host ""
Write-Host "Setting $($nic.Name) to DHCP..." -ForegroundColor Yellow
& netsh interface ipv4 set address name="$($nic.Name)" source=dhcp
& netsh interface ipv4 set dnsservers name="$($nic.Name)" source=dhcp
$null = & netsh interface ipv4 set address name="$($nic.Name)" source=dhcp 2>&1
$null = & netsh interface ipv4 set dnsservers name="$($nic.Name)" source=dhcp 2>&1
Write-Host "Done." -ForegroundColor Green
}
else {
@ -125,9 +125,9 @@ else {
Write-Host "Setting $($nic.Name) -> $ip / $mask$( if ($gw) { " via $gw" })" -ForegroundColor Yellow
if ([string]::IsNullOrWhiteSpace($gw)) {
& netsh interface ipv4 set address name="$($nic.Name)" static $ip $mask
$null = & netsh interface ipv4 set address name="$($nic.Name)" static $ip $mask 2>&1
} else {
& netsh interface ipv4 set address name="$($nic.Name)" static $ip $mask $gw
$null = & netsh interface ipv4 set address name="$($nic.Name)" static $ip $mask $gw 2>&1
}
Write-Host "Done." -ForegroundColor Green
}