@echo off if not "%1"=="$" ( for /f "tokens=2" %%i in ('"%~0" $^|sort') do echo %%i&goto :eof ) else ( for /f %%i in (ip.txt) do call :rnd %%i ) goto :eof :rnd echo %random% %1 goto :eof