Windows equivalent to xargs?
Solution 1:
I think that installing original tools is much better in terms of unification then rewriting everything. I personally use GOW, it still misses a tiny number of commands but contains all most needed stuff.
If you still want to hit batch programming there's a good list of all commands: http://ss64.com/nt/, I think you need forfiles
.
Solution 2:
Copied from here
@echo off
:: example: git branch | grep -v "develop" | xargs git branch -D
:: example xargs -a input.txt echo
:: https://helloacm.com/simple-xargs-batch-implementation-for-windows/
setlocal enabledelayedexpansion
set args=
set file='more'
:: read from file
if "%1" == "-a" (
if "%2" == "" (
echo Correct Usage: %0 -a Input.txt command
goto end
)
set file=%2
shift
shift
goto start
)
:: read from stdin
set args=%1
shift
:start
if [%1] == [] goto start1
set args=%args% %1
shift
goto start
:start1
for /F "tokens=*" %%a in (!file!) do (
%args% %%a
)
:end