Question

I don't know how can i make this clear in a short sentence, so i give this example

Bash :

./foo $(ls -a)

First, "ls -a" is evaluated and converts to its output. So we 've got this line

./foo some_script Downloads

and then that's executed.

How can i achieve the same by using the windows command line?

P.S. : I need to use it when my IDE makes a build, so using PowerShell or CygWin is not an option

Was it helpful?

Solution

Assuming that the filenames contain no embedded spaces:

@echo off
setlocal enabledelayedexpansion

set "args="
for /f "delims=" %%i in ('dir /a /b') do set "args=!args!%%i "

.\foo %args%
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top