Skip to content

Instantly share code, notes, and snippets.

@muink
Last active January 10, 2025 04:59
Show Gist options
  • Save muink/e27dd8f7927eb6b59a31d9677d20571e to your computer and use it in GitHub Desktop.
Save muink/e27dd8f7927eb6b59a31d9677d20571e to your computer and use it in GitHub Desktop.
Mac Options adder
:: Mac Options adder
:: Mac Options adder
:: Author: muink
@echo off&title Mac Options adder&color 3f
:Main
setlocal enabledelayedexpansion
set Class=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class
set Network=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network
set GUID={4D36E972-E325-11CE-BFC1-08002BE10318}
set DEVcount=
:FindDevices
cls
echo.Searching devices...
for /f %%i in ('reg query %Class%\%GUID%') do (
echo."%%i"|find /i "\%GUID%\" >nul 2>nul&&(
echo."%%i"|find /i "\Properties" >nul 2>nul||(
for /f "tokens=1-3" %%j in ('reg query %%i /v DeviceInstanceID') do (
echo."%%l"|findstr /i "PCI\\ USB\\" >nul 2>nul&&(
rem true
set /a DEVcount+=1
set "Net!DEVcount!_Path=%%i"
for /f "delims=" %%m in ('reg query %%i /v DriverDesc 2^>nul') do set "Net!DEVcount!_Name=%%m"
for /f "delims=" %%m in ('reg query %%i /v NetCfgInstanceId 2^>nul') do set "NetCfgID=%%m"
for /f "delims=" %%m in ('reg query %Network%\%GUID%\!NetCfgID:~34!\Connection /v Name 2^>nul') do set "Internet!DEVcount!_Name=%%m"
) ) ) ) )
:ChoiceDevices
cls
set TableHead=Number Connection Name Device Name
echo.%TableHead%
for /l %%i in (1,1,%DEVcount%) do echo.[%%i] !Internet%%i_Name:~22! !Net%%i_Name:~28!
echo.&set /p ChoiceID= Please enter the NIC number you want to operate:
if not defined ChoiceID goto ChoiceDevices
set /a ChoiceID=%ChoiceID%
if %ChoiceID% equ 0 goto ChoiceDevices
if %ChoiceID% geq 1 if %ChoiceID% leq %DEVcount% (echo.>nul) else goto ChoiceDevices
ping /n 5 127.0.0.1>nul
:SetMacOptions
cls
echo.
set OptionsName=Network Address
set /p OptionsName= Custom name for added option (Default is "Network Address"):
:AddMacOptions
(reg add !Net%ChoiceID%_Path!\Ndi\Params\NetworkAddress /v ParamDesc /d "%OptionsName%" /f
reg add !Net%ChoiceID%_Path!\Ndi\Params\NetworkAddress /v Default /f
reg add !Net%ChoiceID%_Path!\Ndi\Params\NetworkAddress /v Optional /d 1 /f
reg add !Net%ChoiceID%_Path!\Ndi\Params\NetworkAddress /v Type /d edit /f
reg add !Net%ChoiceID%_Path!\Ndi\Params\NetworkAddress /v LimitText /d 12 /f
reg add !Net%ChoiceID%_Path!\Ndi\Params\NetworkAddress /v UpperCase /d 1 /f) >nul 2>nul
:Done
cls&echo.&echo.ALL DONE...
ping /n 5 127.0.0.1>nul
:END
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment