Skip to content
Advertisement

What is the Windows equivalent of `{} +` in Linux Shell?

I’m trying to make a simple batch file to compile some code and I can’t for the life of me figure out or find any information on how to do this.

On Linux, I’m doing this:

find ./bin-int/ -type f -name '*.o' -exec rgblink -o ./bin/lapis.gb -n ./bin-int/symbols.sym {} +

This basically finds all the files in ./bin-int/ with the extension .o, and use them as the input variable for the command rgblink.

But I can’t for the life of me figure out how to do this on Windows. The closest I got is

for /r ".bin-int" %%i in (*.o); do rgblink -o ./bin/lapis.gb  -n ./bin-int/symbols.sym %%i

which is wrong because I don’t want to run the command once for EACH file. I want the EVERY file to be the input for the command, at the same time.

How can I do this? Thanks!

Advertisement

Answer

You’ll need to append the list to a variable first, then run the list in the command:

@for /r ".bin-int" %%i in (*.o) do @call set "list=%%list%% %%i"
rgblink -o ./bin-int/lapis.gb  -n ./bin-int/symbols.sym%list%

this is untested as I cannot confirm what your list should look like exactly, but you’ll get the idea.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement