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