@echo off c: dir /s/b rx.exe >c:\rxlocation.txt for /F "tokens=*" %%I in (c:\rxlocation.txt) do call :DOTHEWORK "%%I" goto :EOF :DOTHEWORK echo %1 netsh firewall add allowedprogram %1 reflection enable custom 127.0.0.1 goto :eof