Windows相当于xargs?


Answers:


11

我认为安装原始工具在统一方面要好于重写所有内容。我个人使用GOW,它仍然会丢失少量命令,但包含所有最需要的内容。

如果您仍然想进行批量编程,那么所有命令都有一个不错的列表:http : //ss64.com/nt/,我认为您需要forfiles


相同的xargs.exe可以在包中找到findutils从项目GnuWingnuwin32.sourceforge.net/packages/findutils.htm
tehnicaorg

1

这里复制

@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

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.