My solution is essentially identical to Aacini's but with a few differing details:
@echo off
setlocal enabledelayedexpansion
set i=0
for /f "tokens=*" %%x in (%1) do (
set line[!i!]=%%x
set /a i += 1
)
set /a j=%random% %% %i%
set ip=!line[%j%]!
The file name is an argument to this batch.