Skip to content

Instantly share code, notes, and snippets.

@San3ko
Last active December 22, 2015 13:19
Show Gist options
  • Save San3ko/6478626 to your computer and use it in GitHub Desktop.
Save San3ko/6478626 to your computer and use it in GitHub Desktop.
dir 320 tftp script
@echo off
echo ==================================================================
echo This batch file will upload dd-wrt firmware in the current directory to
echo 192.168.0.1 during the router's bootup.
echo.
echo * Set your ethernet card's settings to:
echo IP: 192.168.0.2 echo Mask: 255.255.255.0 echo Gateway: 192.168.0.1
echo * Unplug the router's power cable.
echo.
echo Press Ctrl+C to abort or any other key to continue... pause > nul
echo.
echo * Re-plug the router's power cable.
echo.
echo ==================================================================
echo Waiting for the router... Press Ctrl+C to abort.
echo.
set FIND=%WINDIR%\command\find.exe
if exist %FIND% goto PING
set FIND=%WINDIR%\system32\find.exe
if exist %FIND% goto PING
set FIND=find
:PING
ping -n 1 -w 50 192.168.0.1 | %FIND% "TTL="
if errorlevel 1 goto PING
echo *** Start Flashing ****
tftp -i 192.168.0.1 put firmware.bin
if errorlevel 1 goto PING
set FIND=
echo.
echo ==================================================================
echo * WAIT for about 2 minutes while the firmware is being flashed.
echo * Reset your ethernet card's settings back to DHCP.
echo * The default router address will be at 192.168.1.1
echo.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment