Skip to content

Instantly share code, notes, and snippets.

@schrobby
Created October 23, 2021 02:45
Show Gist options
  • Save schrobby/42c0cd4dca984788f2f2139d70d70efe to your computer and use it in GitHub Desktop.
Save schrobby/42c0cd4dca984788f2f2139d70d70efe to your computer and use it in GitHub Desktop.
@echo off
net session >nul 2>&1
if %errorLevel% neq 0 (
echo ERROR: Run again with admin privileges.
exit 1
)
netsh interface ipv4 set subinterface "NordLynx" mtu=1300 store=persistent
netsh interface ipv4 show subinterfaces "NordLynx"
@torkcm
Copy link

torkcm commented May 3, 2022

This will call admin prompt

@echo off

call :isAdmin

if %errorlevel% == 0 (
goto :run
) else (
echo Requesting administrative privileges...
goto :UACPrompt
)

exit /b

:isAdmin
fsutil dirty query %systemdrive% >nul
exit /b

:run
netsh interface ipv4 set subinterface "NordLynx" mtu=1320
netsh interface ipv4 show subinterface
pause
exit /b

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %~1", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment