Skip to content

Fix failure when netadapter's name includes space #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/helper/win32/config_route.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set TUN_GW=%1
set DEVICE_NAME=%2

for /f "skip=3 tokens=4" %%a in ('netsh interface show interface') do (
for /f "delims=," %%a in ('Getmac /v /nh /fo csv') do (
netsh interface ipv6 set interface %%a routerdiscovery=disabled
)
netsh interface ip add route 0.0.0.0/0 %DEVICE_NAME% %TUN_GW% metric=0 store=active
Expand Down
4 changes: 2 additions & 2 deletions src/helper/win32/ensure_tap_device.bat
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if %errorlevel% neq 0 (
type "%BEFORE_DEVICES%"

echo Creating TAP network device...
for /f "tokens=4 delims=[.] " %%i in ('ver') do (
for /f "skip=1 delims=." %%i in ('wmic os get version') do (
if %%i==10 %TAP_WINDOWS_PATH%\tap-windows-9.24.2-I601-Win10.exe /S
if %%i==6 %TAP_WINDOWS_PATH%\tap-windows-9.24.2-I601-Win7.exe /S
)
Expand Down Expand Up @@ -154,7 +154,7 @@ netsh interface set interface "%DEVICE_NAME%" admin=enabled
:: )

echo Set all adapters metric to auto.
for /f "skip=3 tokens=4" %%a in ('netsh interface show interface') do (
for /f "delims=," %%a in ('Getmac /v /nh /fo csv') do (
netsh interface ip set interface %%a metric=automatic
netsh interface ipv6 set interface %%a metric=automatic
)
Expand Down
2 changes: 1 addition & 1 deletion src/helper/win32/recover_route.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set DEVICE_NAME=%1

for /f "skip=3 tokens=4" %%a in ('netsh interface show interface') do (
for /f "delims=," %%a in ('Getmac /v /nh /fo csv') do (
netsh interface ipv6 set interface %%a routerdiscovery=enabled
)
netsh interface ip delete route 0.0.0.0/0 %DEVICE_NAME%
Expand Down