33 lines
743 B
Batchfile
33 lines
743 B
Batchfile
|
|
@echo off
|
||
|
|
:: Network Configuration Launcher
|
||
|
|
:: This batch file launches the PowerShell script with administrator privileges
|
||
|
|
|
||
|
|
title Network Adapter Configuration Tool
|
||
|
|
|
||
|
|
:: Check if running as administrator
|
||
|
|
net session >nul 2>&1
|
||
|
|
if %errorLevel% == 0 (
|
||
|
|
goto :run_script
|
||
|
|
) else (
|
||
|
|
echo Requesting administrator privileges...
|
||
|
|
goto :elevate
|
||
|
|
)
|
||
|
|
|
||
|
|
:elevate
|
||
|
|
:: Request administrator elevation
|
||
|
|
powershell -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
|
||
|
|
exit /b
|
||
|
|
|
||
|
|
:run_script
|
||
|
|
:: Run the PowerShell script
|
||
|
|
cd /d "%~dp0"
|
||
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0Set-NetworkAdapter.ps1"
|
||
|
|
|
||
|
|
:: Pause if there was an error
|
||
|
|
if %errorLevel% neq 0 (
|
||
|
|
echo.
|
||
|
|
echo An error occurred while running the script.
|
||
|
|
pause
|
||
|
|
)
|
||
|
|
|
||
|
|
exit /b
|