set range=192.168.1 rem - ::::::::Do not Change anything below this line::::::::: :Find rem sets directory to wherever batch file is setlocal cd /d %~dp0 rem Sets MAC to search for set GivMac=34-ea-e7 @echo off cls Echo Step 1: Givenergy Auto Discover REM runs arp command and stores table into text file (not needed to make auto dicsocvery work, just handy to see) arp -a >NetworkIPList.txt Echo Full Network List Saved to File "NetworkIPList.txt" Timeout 5 REM Same as above above searches table for first 3 MAC identifiers & spits out related IP if found (errors if no MAC found) SETLOCAL ENABLEDELAYEDEXPANSION FOR /f "tokens=1,2" %%a in ('arp -a ^| findstr /i %GivMac%') do ( @echo IP: %%a MAC: %%b SET "InvIP=%%a" SET "InvMAC=%%b" cls GOTO :Found ) Rem goes to error section if not found. Goto :Failed :Found cls echo Step 2: DEVICES FOUND echo Givenergy Inverter %InvMAC% found with IP Address of: %InvIP% timeout 60 Exit :end Echo. Echo Setup Cancelled. Exit in 10... Timeout 10 Exit :Failed Echo. Echo No Inverter Found in ARP Table with correct MAC on Network set "reply=y" set /p "reply=Attempt to ping all devices on netwok? (Will take a while...) [y|n]: " if /i not "%reply%" == "y" goto :Error for /l %%i in (1,1,254) do ping -n 1 %range%.%%i set "reply=y" set /p "reply=Attempt to find inverter again? [y|n]: " if /i not "%reply%" == "y" goto :end goto :Find :Error Echo. Echo No Inverter Found with correct MAC on Network Timeout 30 Exit