This should do it.
I don't recall what it is but there is a limit as to the number of characters you can include on a single line so if you have hundreds of files you want to include, this probably will not work for you.
But if you don't have too many, this will work.
echo off
setlocal ENABLEDELAYEDEXPANSION
set params=
for /f %%i in ('dir /b /a-d') do (
set params=!params! "%%i"
)
echo on
foo.exe %params%