Windows xargs Clone

There already exists a Windows xargs clone at the FindUtils for Windows GnuWin32 page. However at the time of last investigation I don't believe this had support for the -P <n> switch which allowed parallel processing of arguments.

So I wrote a simple clone in C and compiled using MinGW.

This clone is called PPX2 and is designed to function similarly to xargs but is a simplified version. No responsibility is taken for any problems you may have using this tool.

Download

You can get a copy of the tool here: ppx2.exe (16KB).

The source code is made publically available here: ppx2.c (17KB) and is entirely my own work.

Examples

I primarily wrote this to take advantage of my multi-CPU Windows desktop so I could process videos/images in bulk using all my processors.

Calculating SHA1 Sums

As a basic example one can calculate the SHA1 of all the files in a directory tree by running:

  dir C:\ /s /b |ppx2 -I {} -P 4 -L 1 sha1sum "{}"

The -I {} is not necessary as it is configured that way by default. The -P 4 allows a maximum of 4 simultaneous processes. The -L 1 instructs the tool to split by line rather than by whitespace.

Converting Videos

Some versions of ffmpeg are already multi-processor capable. Of those that are there are some limitations depending on the codec used.

To convert mpg to mp4 I did the following:

  dir /b *.mpg |ppx2 -P 4 -L 1 ffmpeg.exe -i "{}" -quality:v 1 "{}.mp4"

It is necessary to surround the {} in double quotes as Windows filenames often contain spaces.