Simple xargs replacement for Windows Shell

image.png

xargs builds the command from the standard input - however, it is not available for Windows command shell... therefore I 've decided to build one and it turns out a Batch script is enough...

Source: https://github.com/DoctorLai/BatchUtils/blob/master/xargs.cmd

@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

Building command from standard input:
image.png

Building command from text file:
image.png

Reposted to blog: https://helloacm.com/simple-xargs-batch-implementation-for-windows/


Enjoy and Steem On!

Delegate to @justyy

@justyy runs a automatic delegation service for nearly a year now. Delegate to @justyy for at least 5 SP and start receiving daily payout as interests (from 8% to 10% APR). Also, as a supporter, the delegators will start to receive complimentary/curation upvotes (as a thank you) per day from e.g @justyy and a few other curation trails. For more information, read this. The voting weight algorithm is open source.

image.png

Please note that the SP you enter is the final amount to delegate. For example, if you already delegate 10 SP and you want to delegate another 5 SP, you will need to enter 15 SP (instead of 5 SP) in the delegation form.

Vote for me or Set me as a witness Proxy - Every vote counts! - Thank you!

Your Vote is much appreciated, and every vote counts.

Check out My Witness Page

Support me and my work as a witness - witness thread by

  1. voting me here, or
  2. voting me as a witness proxy - let @justyy represent you.

Thank you! Some of My Contributions: SteemYY.com - SteemIt Tutorials, Robots, Tools and APIs and VPS Search Tool

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center